@scalar/helpers 0.4.1 → 0.4.2

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 (111) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/array/add-to-map-array.js +7 -8
  3. package/dist/array/is-defined.js +12 -5
  4. package/dist/array/sort-by-order.js +60 -18
  5. package/dist/consts/content-types.js +13 -14
  6. package/dist/dom/freeze-element.js +56 -42
  7. package/dist/dom/scroll-to-id.js +33 -27
  8. package/dist/file/json2xml.js +79 -61
  9. package/dist/general/create-limiter.js +47 -31
  10. package/dist/general/debounce.js +86 -66
  11. package/dist/general/extract-config-secrets.js +29 -27
  12. package/dist/general/has-modifier.js +9 -8
  13. package/dist/general/is-mac-os.js +23 -21
  14. package/dist/http/can-method-have-body.js +4 -6
  15. package/dist/http/http-info.js +63 -61
  16. package/dist/http/http-methods.js +4 -7
  17. package/dist/http/http-status-codes.js +316 -320
  18. package/dist/http/is-http-method.js +3 -6
  19. package/dist/http/normalize-http-method.js +19 -19
  20. package/dist/json/escape-json-pointer.js +6 -5
  21. package/dist/json/parse-json-pointer-segments.js +11 -6
  22. package/dist/json/pretty-print-json.d.ts +9 -0
  23. package/dist/json/pretty-print-json.d.ts.map +1 -0
  24. package/dist/json/pretty-print-json.js +42 -0
  25. package/dist/json/unescape-json-pointer.js +7 -5
  26. package/dist/node/path.js +168 -138
  27. package/dist/object/get-value-at-path.js +17 -11
  28. package/dist/object/is-object.js +24 -10
  29. package/dist/object/local-storage.js +50 -42
  30. package/dist/object/object-entries.js +2 -5
  31. package/dist/object/object-keys.js +5 -5
  32. package/dist/object/object-replace.js +13 -12
  33. package/dist/object/omit-undefined-values.js +18 -18
  34. package/dist/object/prevent-pollution.js +27 -10
  35. package/dist/object/to-json-compatible.js +71 -62
  36. package/dist/queue/queue.js +103 -84
  37. package/dist/regex/find-variables.js +13 -8
  38. package/dist/regex/regex-helpers.js +17 -17
  39. package/dist/regex/replace-variables.js +21 -19
  40. package/dist/string/camel-to-title.js +10 -5
  41. package/dist/string/capitalize.js +5 -5
  42. package/dist/string/create-hash.js +19 -16
  43. package/dist/string/generate-hash.js +153 -127
  44. package/dist/string/iterate-title.js +13 -11
  45. package/dist/string/truncate.js +16 -9
  46. package/dist/testing/console-spies.js +19 -24
  47. package/dist/testing/measure.js +42 -19
  48. package/dist/testing/measure.test-d.js +12 -9
  49. package/dist/testing/sleep.js +5 -5
  50. package/dist/url/ensure-protocol.js +8 -10
  51. package/dist/url/extract-server-from-path.js +53 -28
  52. package/dist/url/is-local-url.js +24 -18
  53. package/dist/url/is-relative-path.js +15 -13
  54. package/dist/url/is-valid-url.js +17 -10
  55. package/dist/url/make-url-absolute.js +39 -28
  56. package/dist/url/merge-urls.js +74 -52
  57. package/dist/url/redirect-to-proxy.js +68 -39
  58. package/package.json +5 -9
  59. package/dist/array/add-to-map-array.js.map +0 -7
  60. package/dist/array/is-defined.js.map +0 -7
  61. package/dist/array/sort-by-order.js.map +0 -7
  62. package/dist/consts/content-types.js.map +0 -7
  63. package/dist/dom/freeze-element.js.map +0 -7
  64. package/dist/dom/scroll-to-id.js.map +0 -7
  65. package/dist/file/json2xml.js.map +0 -7
  66. package/dist/general/create-limiter.js.map +0 -7
  67. package/dist/general/debounce.js.map +0 -7
  68. package/dist/general/extract-config-secrets.js.map +0 -7
  69. package/dist/general/has-modifier.js.map +0 -7
  70. package/dist/general/is-mac-os.js.map +0 -7
  71. package/dist/http/can-method-have-body.js.map +0 -7
  72. package/dist/http/http-info.js.map +0 -7
  73. package/dist/http/http-methods.js.map +0 -7
  74. package/dist/http/http-status-codes.js.map +0 -7
  75. package/dist/http/is-http-method.js.map +0 -7
  76. package/dist/http/normalize-http-method.js.map +0 -7
  77. package/dist/json/escape-json-pointer.js.map +0 -7
  78. package/dist/json/parse-json-pointer-segments.js.map +0 -7
  79. package/dist/json/unescape-json-pointer.js.map +0 -7
  80. package/dist/node/path.js.map +0 -7
  81. package/dist/object/get-value-at-path.js.map +0 -7
  82. package/dist/object/is-object.js.map +0 -7
  83. package/dist/object/local-storage.js.map +0 -7
  84. package/dist/object/object-entries.js.map +0 -7
  85. package/dist/object/object-keys.js.map +0 -7
  86. package/dist/object/object-replace.js.map +0 -7
  87. package/dist/object/omit-undefined-values.js.map +0 -7
  88. package/dist/object/prevent-pollution.js.map +0 -7
  89. package/dist/object/to-json-compatible.js.map +0 -7
  90. package/dist/queue/queue.js.map +0 -7
  91. package/dist/regex/find-variables.js.map +0 -7
  92. package/dist/regex/regex-helpers.js.map +0 -7
  93. package/dist/regex/replace-variables.js.map +0 -7
  94. package/dist/string/camel-to-title.js.map +0 -7
  95. package/dist/string/capitalize.js.map +0 -7
  96. package/dist/string/create-hash.js.map +0 -7
  97. package/dist/string/generate-hash.js.map +0 -7
  98. package/dist/string/iterate-title.js.map +0 -7
  99. package/dist/string/truncate.js.map +0 -7
  100. package/dist/testing/console-spies.js.map +0 -7
  101. package/dist/testing/measure.js.map +0 -7
  102. package/dist/testing/measure.test-d.js.map +0 -7
  103. package/dist/testing/sleep.js.map +0 -7
  104. package/dist/url/ensure-protocol.js.map +0 -7
  105. package/dist/url/extract-server-from-path.js.map +0 -7
  106. package/dist/url/is-local-url.js.map +0 -7
  107. package/dist/url/is-relative-path.js.map +0 -7
  108. package/dist/url/is-valid-url.js.map +0 -7
  109. package/dist/url/make-url-absolute.js.map +0 -7
  110. package/dist/url/merge-urls.js.map +0 -7
  111. package/dist/url/redirect-to-proxy.js.map +0 -7
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/http/http-status-codes.ts"],
4
- "sourcesContent": ["export type HttpStatusCode = {\n name: string\n url: string\n color: string\n}\n\nexport type HttpStatusCodes = Record<string | number, HttpStatusCode>\n\nexport const httpStatusCodes: HttpStatusCodes = {\n 100: {\n name: 'Continue',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/100',\n color: 'var(--scalar-color-blue)',\n },\n 101: {\n name: 'Switching Protocols',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/101',\n color: 'var(--scalar-color-blue)',\n },\n 102: {\n name: 'Processing',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/102',\n color: 'var(--scalar-color-blue)',\n },\n 103: {\n name: 'Early Hints',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/103',\n color: 'var(--scalar-color-blue)',\n },\n 200: {\n name: 'OK',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/200',\n color: 'var(--scalar-color-green)',\n },\n 201: {\n name: 'Created',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/201',\n color: 'var(--scalar-color-green)',\n },\n 202: {\n name: 'Accepted',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/202',\n color: 'var(--scalar-color-green)',\n },\n 203: {\n name: 'Non-Authoritative Information',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/203',\n color: 'var(--scalar-color-green)',\n },\n 204: {\n name: 'No Content',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/204',\n color: 'var(--scalar-color-green)',\n },\n 205: {\n name: 'Reset Content',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/205',\n color: 'var(--scalar-color-green)',\n },\n 206: {\n name: 'Partial Content',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/206',\n color: 'var(--scalar-color-green)',\n },\n 207: {\n name: 'Multi-Status',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/207',\n color: 'var(--scalar-color-green)',\n },\n 208: {\n name: 'Already Reported',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/208',\n color: 'var(--scalar-color-green)',\n },\n 226: {\n name: 'IM Used',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/226',\n color: 'var(--scalar-color-green)',\n },\n 300: {\n name: 'Multiple Choices',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/300',\n color: 'var(--scalar-color-yellow)',\n },\n 301: {\n name: 'Moved Permanently',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/301',\n color: 'var(--scalar-color-yellow)',\n },\n 302: {\n name: 'Found',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/302',\n color: 'var(--scalar-color-yellow)',\n },\n 303: {\n name: 'See Other',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/303',\n color: 'var(--scalar-color-yellow)',\n },\n 304: {\n name: 'Not Modified',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/304',\n color: 'var(--scalar-color-yellow)',\n },\n 305: {\n name: 'Use Proxy',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/305',\n color: 'var(--scalar-color-yellow)',\n },\n 306: {\n name: '(Unused)',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/306',\n color: 'var(--scalar-color-yellow)',\n },\n 307: {\n name: 'Temporary Redirect',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/307',\n color: 'var(--scalar-color-yellow)',\n },\n 308: {\n name: 'Permanent Redirect',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/308',\n color: 'var(--scalar-color-yellow)',\n },\n 400: {\n name: 'Bad Request',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/400',\n color: 'var(--scalar-color-red)',\n },\n 401: {\n name: 'Unauthorized',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/401',\n color: 'var(--scalar-color-red)',\n },\n 402: {\n name: 'Payment Required',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/402',\n color: 'var(--scalar-color-red)',\n },\n 403: {\n name: 'Forbidden',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403',\n color: 'var(--scalar-color-red)',\n },\n 404: {\n name: 'Not Found',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/404',\n color: 'var(--scalar-color-red)',\n },\n 405: {\n name: 'Method Not Allowed',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405',\n color: 'var(--scalar-color-red)',\n },\n 406: {\n name: 'Not Acceptable',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/406',\n color: 'var(--scalar-color-red)',\n },\n 407: {\n name: 'Proxy Authentication Required',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/407',\n color: 'var(--scalar-color-red)',\n },\n 408: {\n name: 'Request Timeout',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408',\n color: 'var(--scalar-color-red)',\n },\n 409: {\n name: 'Conflict',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/409',\n color: 'var(--scalar-color-red)',\n },\n 410: {\n name: 'Gone',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/410',\n color: 'var(--scalar-color-red)',\n },\n 411: {\n name: 'Length Required',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/411',\n color: 'var(--scalar-color-red)',\n },\n 412: {\n name: 'Precondition Failed',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/412',\n color: 'var(--scalar-color-red)',\n },\n 413: {\n name: 'Content Too Large',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/413',\n color: 'var(--scalar-color-red)',\n },\n 414: {\n name: 'URI Too Long',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/414',\n color: 'var(--scalar-color-red)',\n },\n 415: {\n name: 'Unsupported Media Type',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/415',\n color: 'var(--scalar-color-red)',\n },\n 416: {\n name: 'Range Not Satisfiable',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/416',\n color: 'var(--scalar-color-red)',\n },\n 417: {\n name: 'Expectation Failed',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/417',\n color: 'var(--scalar-color-red)',\n },\n 418: {\n name: \"I'm a teapot\",\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/418',\n color: 'var(--scalar-color-red)',\n },\n 421: {\n name: 'Misdirected Request',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/421',\n color: 'var(--scalar-color-red)',\n },\n 422: {\n name: 'Unprocessable Content',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/422',\n color: 'var(--scalar-color-red)',\n },\n 423: {\n name: 'Locked',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/423',\n color: 'var(--scalar-color-red)',\n },\n 424: {\n name: 'Failed Dependency',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/424',\n color: 'var(--scalar-color-red)',\n },\n 425: {\n name: 'Too Early',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/425',\n color: 'var(--scalar-color-red)',\n },\n 426: {\n name: 'Upgrade Required',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/426',\n color: 'var(--scalar-color-red)',\n },\n 428: {\n name: 'Precondition Required',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/428',\n color: 'var(--scalar-color-red)',\n },\n 429: {\n name: 'Too Many Requests',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429',\n color: 'var(--scalar-color-red)',\n },\n 431: {\n name: 'Request Header Fields Too Large',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/431',\n color: 'var(--scalar-color-red)',\n },\n 451: {\n name: 'Unavailable For Legal Reasons',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/451',\n color: 'var(--scalar-color-red)',\n },\n 500: {\n name: 'Internal Server Error',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500',\n color: 'var(--scalar-color-red)',\n },\n 501: {\n name: 'Not Implemented',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/501',\n color: 'var(--scalar-color-red)',\n },\n 502: {\n name: 'Bad Gateway',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502',\n color: 'var(--scalar-color-red)',\n },\n 503: {\n name: 'Service Unavailable',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503',\n color: 'var(--scalar-color-red)',\n },\n 504: {\n name: 'Gateway Timeout',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504',\n color: 'var(--scalar-color-red)',\n },\n 505: {\n name: 'HTTP Version Not Supported',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/505',\n color: 'var(--scalar-color-red)',\n },\n 506: {\n name: 'Variant Also Negotiates',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/506',\n color: 'var(--scalar-color-red)',\n },\n 507: {\n name: 'Insufficient Storage',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/507',\n color: 'var(--scalar-color-red)',\n },\n 508: {\n name: 'Loop Detected',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/508',\n color: 'var(--scalar-color-red)',\n },\n 510: {\n name: 'Not Extended',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/510',\n color: 'var(--scalar-color-red)',\n },\n 511: {\n name: 'Network Authentication Required',\n url: 'https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/511',\n color: 'var(--scalar-color-red)',\n },\n}\n"],
5
- "mappings": "AAQO,MAAM,kBAAmC;AAAA,EAC9C,KAAK;AAAA,IACH,MAAM;AAAA,IACN,KAAK;AAAA,IACL,OAAO;AAAA,EACT;AAAA,EACA,KAAK;AAAA,IACH,MAAM;AAAA,IACN,KAAK;AAAA,IACL,OAAO;AAAA,EACT;AAAA,EACA,KAAK;AAAA,IACH,MAAM;AAAA,IACN,KAAK;AAAA,IACL,OAAO;AAAA,EACT;AAAA,EACA,KAAK;AAAA,IACH,MAAM;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A,IACL,OAAO;AAAA,EACT;AAAA,EACA,KAAK;AAAA,IACH,MAAM;AAAA,IACN,KAAK;AAAA,IACL,OAAO;AAAA,EACT;AAAA,EACA,KAAK;AAAA,IACH,MAAM;AAAA,IACN,KAAK;AAAA,IACL,OAAO;AAAA,EACT;AAAA,EACA,KAAK;AAAA,IACH,MAAM;AAAA,IACN,KAAK;AAAA,IACL,OAAO;AAAA,EACT;AAAA,EACA,KAAK;AAAA,IACH,MAAM;AAAA,IACN,KAAK;AAAA,IACL,OAAO;AAAA,EACT;AAAA,EACA,KAAK;AAAA,IACH,MAAM;AAAA,IACN,KAAK;AAAA,IACL,OAAO;AAAA,EACT;AAAA,EACA,KAAK;AAAA,IACH,MAAM;AAAA,IACN,KAAK;AAAA,IACL,OAAO;AAAA,EACT;AAAA,EACA,KAAK;AAAA,IACH,MAAM;AAAA,IACN,KAAK;AAAA,IACL,OAAO;AAAA,EACT;AAAA,EACA,KAAK;AAAA,IACH,MAAM;AAAA,IACN,KAAK;AAAA,IACL,OAAO;AAAA,EACT;AAAA,EACA,KAAK;AAAA,IACH,MAAM;AAAA,IACN,KAAK;AAAA,IACL,OAAO;AAAA,EACT;AAAA,EACA,KAAK;AAAA,IACH,MAAM;AAAA,IACN,KAAK;AAAA,IACL,OAAO;AAAA,EACT;AAAA,EACA,KAAK;AAAA,IACH,MAAM;AAAA,IACN,KAAK;AAAA,IACL,OAAO;AAAA,EACT;AAAA,EACA,KAAK;AAAA,IACH,MAAM;AAAA,IACN,KAAK;AAAA,IACL,OAAO;AAAA,EACT;AACF;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/http/is-http-method.ts"],
4
- "sourcesContent": ["import { httpMethods, type HttpMethod } from './http-methods'\n\n/** Type guard which takes in a string and returns true if it is in fact an HTTPMethod */\nexport const isHttpMethod = (method?: string | undefined): method is HttpMethod =>\n method && typeof method === 'string' ? httpMethods.has(method.toLowerCase() as HttpMethod) : false\n"],
5
- "mappings": "AAAA,SAAS,mBAAoC;AAGtC,MAAM,eAAe,CAAC,WAC3B,UAAU,OAAO,WAAW,WAAW,YAAY,IAAI,OAAO,YAAY,CAAe,IAAI;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/http/normalize-http-method.ts"],
4
- "sourcesContent": ["import type { HttpMethod } from './http-methods'\nimport { isHttpMethod } from './is-http-method'\n\nconst DEFAULT_REQUEST_METHOD = 'get' as const\n\n/**\n * Get a normalized request method (e.g. get, post, etc.)\n * Lowercases the method and returns the default if it is not a valid method so you will always have a valid method\n */\nexport const normalizeHttpMethod = (method?: string): HttpMethod => {\n // Make sure it's a string\n if (typeof method !== 'string') {\n console.warn(`Request method is not a string. Using ${DEFAULT_REQUEST_METHOD} as the default.`)\n\n return DEFAULT_REQUEST_METHOD\n }\n\n // Normalize the string\n const normalizedMethod = method.trim().toLowerCase()\n\n if (!isHttpMethod(normalizedMethod)) {\n console.warn(\n `${method || 'Request method'} is not a valid request method. Using ${DEFAULT_REQUEST_METHOD} as the default.`,\n )\n\n return DEFAULT_REQUEST_METHOD\n }\n\n return normalizedMethod\n}\n"],
5
- "mappings": "AACA,SAAS,oBAAoB;AAE7B,MAAM,yBAAyB;AAMxB,MAAM,sBAAsB,CAAC,WAAgC;AAElE,MAAI,OAAO,WAAW,UAAU;AAC9B,YAAQ,KAAK,yCAAyC,sBAAsB,kBAAkB;AAE9F,WAAO;AAAA,EACT;AAGA,QAAM,mBAAmB,OAAO,KAAK,EAAE,YAAY;AAEnD,MAAI,CAAC,aAAa,gBAAgB,GAAG;AACnC,YAAQ;AAAA,MACN,GAAG,UAAU,gBAAgB,yCAAyC,sBAAsB;AAAA,IAC9F;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/json/escape-json-pointer.ts"],
4
- "sourcesContent": ["/**\n * Escapes a JSON pointer string.\n *\n * Example: `/foo/bar~baz` -> `~1foo~1bar~0baz`\n */\nexport const escapeJsonPointer = (str: string): string => str.replace(/~/g, '~0').replace(/\\//g, '~1')\n"],
5
- "mappings": "AAKO,MAAM,oBAAoB,CAAC,QAAwB,IAAI,QAAQ,MAAM,IAAI,EAAE,QAAQ,OAAO,IAAI;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/json/parse-json-pointer-segments.ts"],
4
- "sourcesContent": ["import { unescapeJsonPointer } from './unescape-json-pointer'\n\n/**\n * Translate `/paths/~1test` to `['paths', '/test']`\n */\nexport const parseJsonPointerSegments = (path: string): string[] =>\n path\n // ['', 'paths', '~1test']\n .split('/')\n // ['paths', '~1test']\n .slice(1)\n // ['paths', '/test']\n .map(unescapeJsonPointer)\n"],
5
- "mappings": "AAAA,SAAS,2BAA2B;AAK7B,MAAM,2BAA2B,CAAC,SACvC,KAEG,MAAM,GAAG,EAET,MAAM,CAAC,EAEP,IAAI,mBAAmB;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/json/unescape-json-pointer.ts"],
4
- "sourcesContent": ["/**\n * Unescape JSON pointer\n *\n * Examples:\n * /foo~1bar~0baz -> /foo/bar~baz\n */\nexport const unescapeJsonPointer = (uri: string): string => decodeURI(uri.replace(/~1/g, '/').replace(/~0/g, '~'))\n"],
5
- "mappings": "AAMO,MAAM,sBAAsB,CAAC,QAAwB,UAAU,IAAI,QAAQ,OAAO,GAAG,EAAE,QAAQ,OAAO,GAAG,CAAC;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/node/path.ts"],
4
- "sourcesContent": ["// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// resolves . and .. elements in a path array with directory names there\n// must be no slashes, empty elements, or device names (c:\\) in the array\n// (so also no leading and trailing slashes - it does not distinguish\n// relative and absolute paths)\n\n// !! WARNING !!\n// The original implementation included ponyfills for `filters` and `substr`.\n// These have been removed in favor of native implementations supported by the current platforms.\n// See: https://github.com/scalar/scalar/pull/7235#discussion_r2484230212\n\nfunction normalizeArray(parts: Array<string>, allowAboveRoot: boolean): Array<string> {\n // if the path tries to go above the root, `up` ends up > 0\n let up = 0\n for (let i = parts.length - 1; i >= 0; i--) {\n const last = parts[i]\n if (last === '.') {\n parts.splice(i, 1)\n } else if (last === '..') {\n parts.splice(i, 1)\n up++\n } else if (up) {\n parts.splice(i, 1)\n up--\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (allowAboveRoot) {\n for (; up--; up) {\n parts.unshift('..')\n }\n }\n\n return parts\n}\n\n// Split a filename into [root, dir, basename, ext], unix version\n// 'root' is just a slash, or nothing.\nconst splitPathRe = /^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^/]+?|)(\\.[^./]*|))(?:[/]*)$/\nconst splitPath = (filename: string): Array<string> | undefined => splitPathRe.exec(filename)!.slice(1)\n\n// path.resolve([from ...], to)\n// posix version\nexport function resolve(...parameters: Array<string>) {\n let resolvedPath = '',\n resolvedAbsolute = false\n\n for (let i = parameters.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n const path = i >= 0 ? parameters[i] : '/'\n\n // Skip empty and invalid entries\n if (typeof path !== 'string') {\n throw new TypeError('Arguments to path.resolve must be strings')\n }\n if (!path) {\n continue\n }\n\n resolvedPath = path + '/' + resolvedPath\n resolvedAbsolute = path.charAt(0) === '/'\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeArray(\n resolvedPath.split('/').filter((p) => !!p),\n !resolvedAbsolute,\n ).join('/')\n\n return (resolvedAbsolute ? '/' : '') + resolvedPath || '.'\n}\n\n// path.normalize(path)\n// posix version\nexport function normalize(inputPath: string): string {\n const isPathAbsolute = isAbsolute(inputPath),\n trailingSlash = inputPath.slice(-1) === '/'\n\n // Normalize the path\n let path = normalizeArray(\n inputPath.split('/').filter((p) => !!p),\n !isPathAbsolute,\n ).join('/')\n\n if (!path && !isPathAbsolute) {\n path = '.'\n }\n if (path && trailingSlash) {\n path += '/'\n }\n\n return (isPathAbsolute ? '/' : '') + path\n}\n\n// posix version\nexport function isAbsolute(path: string): boolean {\n return path.charAt(0) === '/'\n}\n\n// posix version\nexport function join(...paths: string[]) {\n return normalize(\n paths\n .filter((p) => {\n if (typeof p !== 'string') {\n throw new TypeError('Arguments to path.join must be strings')\n }\n return p\n })\n .join('/'),\n )\n}\n\n// path.relative(from, to)\n// posix version\nexport function relative(from: string, to: string) {\n const fromResolved = resolve(from).substring(1)\n const toResolved = resolve(to).substring(1)\n\n function trim(arr: Array<string>): Array<string> {\n let start = 0\n for (; start < arr.length; start++) {\n if (arr[start] !== '') {\n break\n }\n }\n\n let end = arr.length - 1\n for (; end >= 0; end--) {\n if (arr[end] !== '') {\n break\n }\n }\n\n if (start > end) {\n return []\n }\n return arr.slice(start, end - start + 1)\n }\n\n const fromParts = trim(fromResolved.split('/'))\n const toParts = trim(toResolved.split('/'))\n\n const length = Math.min(fromParts.length, toParts.length)\n let samePartsLength = length\n for (let i = 0; i < length; i++) {\n if (fromParts[i] !== toParts[i]) {\n samePartsLength = i\n break\n }\n }\n\n let outputParts = []\n for (let i = samePartsLength; i < fromParts.length; i++) {\n outputParts.push('..')\n }\n\n outputParts = outputParts.concat(toParts.slice(samePartsLength))\n\n return outputParts.join('/')\n}\n\nexport const sep = '/'\nexport const delimiter = ':'\n\nexport function dirname(path: string): string {\n const result = splitPath(path) as Array<string>\n const root = result[0]\n let dir = result[1]\n\n if (!root && !dir) {\n // No dirname whatsoever\n return '.'\n }\n\n if (dir) {\n // It has a dirname, strip trailing slash\n dir = dir.slice(0, -1)\n }\n\n return (root as string) + dir\n}\n\nexport function basename(path: string, ext?: string): string {\n let f = splitPath(path)![2] as string\n // TODO: make this comparison case-insensitive on windows?\n if (ext && f.slice(-ext.length) === ext) {\n f = f.slice(0, -ext.length)\n }\n return f\n}\n\nexport function extname(path: string): string {\n return splitPath(path)![3] as string\n}\n\nexport const path = {\n extname,\n basename,\n dirname,\n sep,\n delimiter,\n relative,\n join,\n isAbsolute,\n normalize,\n resolve,\n}\n"],
5
- "mappings": "AA+BA,SAAS,eAAe,OAAsB,gBAAwC;AAEpF,MAAI,KAAK;AACT,WAAS,IAAI,MAAM,SAAS,GAAG,KAAK,GAAG,KAAK;AAC1C,UAAM,OAAO,MAAM,CAAC;AACpB,QAAI,SAAS,KAAK;AAChB,YAAM,OAAO,GAAG,CAAC;AAAA,IACnB,WAAW,SAAS,MAAM;AACxB,YAAM,OAAO,GAAG,CAAC;AACjB;AAAA,IACF,WAAW,IAAI;AACb,YAAM,OAAO,GAAG,CAAC;AACjB;AAAA,IACF;AAAA,EACF;AAGA,MAAI,gBAAgB;AAClB,WAAO,MAAM,IAAI;AACf,YAAM,QAAQ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5C,QAAM,SAAS,UAAUA,KAAI;AAC7B,QAAM,OAAO,OAAO,CAAC;AACrB,MAAI,MAAM,OAAO,CAAC;AAElB,MAAI,CAAC,QAAQ,CAAC,KAAK;AAEjB,WAAO;AAAA,EACT;AAEA,MAAI,KAAK;AAEP,UAAM,IAAI,MAAM,GAAG,EAAE;AAAA,EACvB;AAEA,SAAQ,OAAkB;AAC5B;AAEO,SAAS,SAASA,OAAc,KAAsB;AAC3D,MAAI,IAAI,UAAUA,KAAI,EAAG,CAAC;AAE1B,MAAI,OAAO,EAAE,MAAM,CAAC,IAAI,MAAM,MAAM,KAAK;AACvC,QAAI,EAAE,MAAM,GAAG,CAAC,IAAI,MAAM;AAAA,EAC5B;AACA,SAAO;AACT;AAEO,SAAS,QAAQA,OAAsB;AAC5C,SAAO,UAAUA,KAAI,EAAG,CAAC;AAC3B;AAEO,MAAM,OAAO;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;",
6
- "names": ["path"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/object/get-value-at-path.ts"],
4
- "sourcesContent": ["/**\n * Retrieves a nested value from the source document using a path array\n *\n * @example\n * ```ts\n * getValueByPath(document, ['components', 'schemas', 'User'])\n *\n * { id: '123', name: 'John Doe' }\n * ```\n */\nexport function getValueAtPath<R = unknown>(obj: any, pointer: string[]): R {\n return pointer.reduce((acc, part) => {\n if (acc === undefined || acc === null) {\n return undefined\n }\n return acc[part]\n }, obj)\n}\n"],
5
- "mappings": "AAUO,SAAS,eAA4B,KAAU,SAAsB;AAC1E,SAAO,QAAQ,OAAO,CAAC,KAAK,SAAS;AACnC,QAAI,QAAQ,UAAa,QAAQ,MAAM;AACrC,aAAO;AAAA,IACT;AACA,WAAO,IAAI,IAAI;AAAA,EACjB,GAAG,GAAG;AACR;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/object/is-object.ts"],
4
- "sourcesContent": ["/**\n * Returns true if the provided value is a record object\n * (i.e. not null, not an array, and has an actual object as the prototype).\n *\n * Differs from the previous isObject in that it returns false for Date,\n * RegExp, Error, Map, Set, WeakMap, WeakSet, Promise, and other non-plain objects.\n *\n * Examples:\n * isObject({}) // true\n * isObject({ a: 1 }) // true\n * isObject([]) // false (Array)\n * isObject(null) // false\n * isObject(123) // false\n * isObject('string') // false\n * isObject(new Error('test')) // false\n * isObject(new Date()) // false\n * isObject(Object.create(null)) // true\n */\nexport const isObject = (value: unknown): value is Record<string, unknown> => {\n if (value === null || typeof value !== 'object') {\n return false\n }\n\n const proto = Object.getPrototypeOf(value)\n return proto === Object.prototype || proto === null\n}\n"],
5
- "mappings": "AAkBO,MAAM,WAAW,CAAC,UAAqD;AAC5E,MAAI,UAAU,QAAQ,OAAO,UAAU,UAAU;AAC/C,WAAO;AAAA,EACT;AAEA,QAAM,QAAQ,OAAO,eAAe,KAAK;AACzC,SAAO,UAAU,OAAO,aAAa,UAAU;AACjD;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/object/local-storage.ts"],
4
- "sourcesContent": ["/**\n * localStorage keys for resources\n * DO NOT CHANGE THESE AS IT WILL BREAK THE MIGRATION\n */\nexport const LS_KEYS = {\n COLLECTION: 'collection',\n COOKIE: 'cookie',\n ENVIRONMENT: 'environment',\n REQUEST: 'request',\n REQUEST_EXAMPLE: 'requestExample',\n SECURITY_SCHEME: 'securityScheme',\n SERVER: 'server',\n TAG: 'tag',\n WORKSPACE: 'workspace',\n} as const\n\n/**\n * localStorage keys for all reference resources\n * to ensure we do not have any conflicts\n */\nexport const REFERENCE_LS_KEYS = {\n /**\n * Store the selected client as a string in localStorage\n */\n SELECTED_CLIENT: 'scalar-reference-selected-client-v2',\n /**\n * Store the auth as a string in localStorage\n */\n AUTH: 'scalar-reference-auth',\n} as const\n\n/**\n * localStorage keys for all client resources\n * to ensure we do not have any conflicts\n */\nexport const CLIENT_LS_KEYS = {\n /**\n * @deprecated This key is deprecated and will be removed in a future release.\n * We are now storing the entire document for the api-client instead.\n */\n AUTH: 'scalar-client-auth',\n /**\n * @deprecated This key is deprecated and will be removed in a future release.\n * We are now storing the entire document for the api-client instead.\n */\n SELECTED_SECURITY_SCHEMES: 'scalar-client-selected-security-schemes',\n} as const\n\n/** SSR safe alias for localStorage */\nexport const safeLocalStorage = () =>\n typeof window === 'undefined'\n ? {\n getItem: () => null,\n setItem: () => null,\n removeItem: () => null,\n }\n : localStorage\n"],
5
- "mappings": "AAIO,MAAM,UAAU;AAAA,EACrB,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,SAAS;AAAA,EACT,iBAAiB;AAAA,EACjB,iBAAiB;AAAA,EACjB,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,WAAW;AACb;AAMO,MAAM,oBAAoB;AAAA;AAAA;AAAA;AAAA,EAI/B,iBAAiB;AAAA;AAAA;AAAA;AAAA,EAIjB,MAAM;AACR;AAMO,MAAM,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA,EAK5B,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA,EAKN,2BAA2B;AAC7B;AAGO,MAAM,mBAAmB,MAC9B,OAAO,WAAW,cACd;AAAA,EACE,SAAS,MAAM;AAAA,EACf,SAAS,MAAM;AAAA,EACf,YAAY,MAAM;AACpB,IACA;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/object/object-entries.ts"],
4
- "sourcesContent": ["/** Type safe version of Object.entries */\nexport const objectEntries = <T extends object>(obj: T): [keyof T, T[keyof T]][] =>\n Object.entries(obj) as [keyof T, T[keyof T]][]\n"],
5
- "mappings": "AACO,MAAM,gBAAgB,CAAmB,QAC9C,OAAO,QAAQ,GAAG;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/object/object-keys.ts"],
4
- "sourcesContent": ["/**\n * Type safe version of Object.keys\n * Can probably remove this whenever typescript adds it\n */\nexport const objectKeys = <T extends object>(obj: T): (keyof T)[] => Object.keys(obj) as (keyof T)[]\n"],
5
- "mappings": "AAIO,MAAM,aAAa,CAAmB,QAAwB,OAAO,KAAK,GAAG;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/object/object-replace.ts"],
4
- "sourcesContent": ["// TODO: This is a copy of org/packages/helpers/src/objects/merge.ts\n\n/**\n * Overwrite a target object a new replacement object handling removed keys\n */\nexport const objectReplace = <A extends object, B extends object>(target: A, replacement: B) => {\n // Clear any keys that have been removed in the replacement\n Object.keys(target).forEach((key) => {\n if (!Object.hasOwn(replacement, key)) {\n delete target[key as keyof A]\n }\n })\n\n Object.assign(target, replacement)\n\n return target as unknown as B\n}\n"],
5
- "mappings": "AAKO,MAAM,gBAAgB,CAAqC,QAAW,gBAAmB;AAE9F,SAAO,KAAK,MAAM,EAAE,QAAQ,CAAC,QAAQ;AACnC,QAAI,CAAC,OAAO,OAAO,aAAa,GAAG,GAAG;AACpC,aAAO,OAAO,GAAc;AAAA,IAC9B;AAAA,EACF,CAAC;AAED,SAAO,OAAO,QAAQ,WAAW;AAEjC,SAAO;AACT;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/object/omit-undefined-values.ts"],
4
- "sourcesContent": ["/**\n * Removes undefined values from an object.\n *\n * Can be used as a transform function for any Zod schema.\n */\nexport const omitUndefinedValues = <T extends object>(data: T): T => {\n // Handle arrays specially\n if (Array.isArray(data)) {\n return data.map((item) =>\n typeof item === 'object' && item !== null ? omitUndefinedValues(item) : item,\n ) as unknown as T\n }\n\n return Object.fromEntries(\n Object.entries(data)\n .filter(([_, value]) => value !== undefined)\n .map(([key, value]) => {\n if (typeof value === 'object' && value !== null) {\n return [key, omitUndefinedValues(value)]\n }\n return [key, value]\n }),\n ) as T\n}\n"],
5
- "mappings": "AAKO,MAAM,sBAAsB,CAAmB,SAAe;AAEnE,MAAI,MAAM,QAAQ,IAAI,GAAG;AACvB,WAAO,KAAK;AAAA,MAAI,CAAC,SACf,OAAO,SAAS,YAAY,SAAS,OAAO,oBAAoB,IAAI,IAAI;AAAA,IAC1E;AAAA,EACF;AAEA,SAAO,OAAO;AAAA,IACZ,OAAO,QAAQ,IAAI,EAChB,OAAO,CAAC,CAAC,GAAG,KAAK,MAAM,UAAU,MAAS,EAC1C,IAAI,CAAC,CAAC,KAAK,KAAK,MAAM;AACrB,UAAI,OAAO,UAAU,YAAY,UAAU,MAAM;AAC/C,eAAO,CAAC,KAAK,oBAAoB,KAAK,CAAC;AAAA,MACzC;AACA,aAAO,CAAC,KAAK,KAAK;AAAA,IACpB,CAAC;AAAA,EACL;AACF;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/object/prevent-pollution.ts"],
4
- "sourcesContent": ["/**\n * Set of dangerous keys that can be used for prototype pollution attacks.\n * These keys should never be used as property names in dynamic object operations.\n */\nconst PROTOTYPE_POLLUTION_KEYS = new Set(['__proto__', 'prototype', 'constructor'])\n\n/**\n * Validates that a key is safe to use and does not pose a prototype pollution risk.\n * Throws an error if a dangerous key is detected.\n *\n * @param key - The key to validate\n * @param context - Optional context string to help identify where the validation failed\n * @throws {Error} If the key matches a known prototype pollution vector\n *\n * @example\n * ```ts\n * preventPollution('__proto__') // throws Error\n * preventPollution('safeName') // passes\n * preventPollution('constructor', 'operation update') // throws Error with context\n * ```\n */\nexport const preventPollution = (key: string, context?: string): void => {\n if (PROTOTYPE_POLLUTION_KEYS.has(key)) {\n const errorMessage = context\n ? `Prototype pollution key detected: \"${key}\" in ${context}`\n : `Prototype pollution key detected: \"${key}\"`\n\n throw new Error(errorMessage)\n }\n}\n"],
5
- "mappings": "AAIA,MAAM,2BAA2B,oBAAI,IAAI,CAAC,aAAa,aAAa,aAAa,CAAC;AAiB3E,MAAM,mBAAmB,CAAC,KAAa,YAA2B;AACvE,MAAI,yBAAyB,IAAI,GAAG,GAAG;AACrC,UAAM,eAAe,UACjB,sCAAsC,GAAG,QAAQ,OAAO,KACxD,sCAAsC,GAAG;AAE7C,UAAM,IAAI,MAAM,YAAY;AAAA,EAC9B;AACF;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/object/to-json-compatible.ts"],
4
- "sourcesContent": ["import { escapeJsonPointer } from '@/json/escape-json-pointer'\nimport { Queue } from '@/queue/queue'\n\ntype RemoveCircularOptions = {\n /** Prefix to add before the path in $ref values */\n prefix?: string\n /** Cache of already processed objects */\n cache?: WeakMap<object, string>\n}\n\n/**\n * Traverses an object or array, returning a deep copy in which circular references are replaced\n * by JSON Reference objects of the form: `{ $ref: \"#/path/to/original\" }`.\n * This allows safe serialization of objects with cycles, following the JSON Reference convention (RFC 6901).\n * An optional `prefix` for the `$ref` path can be provided via options.\n *\n * @param obj - The input object or array to process\n * @param options - Optional configuration; you can set a prefix for $ref pointers\n * @returns A new object or array, with all circular references replaced by $ref pointers\n */\nexport const toJsonCompatible = <T>(obj: T, options: RemoveCircularOptions = {}): T => {\n const { prefix = '', cache = new WeakMap<object, string>() } = options\n\n const toRef = (path: string | undefined) => ({ $ref: `#${path ?? ''}` })\n\n // Primitives and null are returned as-is\n if (typeof obj !== 'object' || obj === null) {\n return obj\n }\n\n const rootPath = prefix\n cache.set(obj as object, rootPath)\n\n const rootResult: unknown = Array.isArray(obj) ? new Array((obj as unknown[]).length) : {}\n\n const queue = new Queue<{ node: object; result: unknown; path: string }>()\n queue.enqueue({ node: obj as object, result: rootResult, path: rootPath })\n\n while (!queue.isEmpty()) {\n const frame = queue.dequeue()\n if (!frame) {\n continue\n }\n\n const { node, result, path } = frame\n\n // Handle arrays (preserve sparse arrays like Array#map does)\n if (Array.isArray(node)) {\n const input = node as unknown[]\n const out = result as unknown[]\n\n for (let index = 0; index < input.length; index++) {\n if (!(index in input)) {\n continue\n }\n\n const item = input[index]\n const itemPath = `${path}/${index}`\n\n if (typeof item !== 'object' || item === null) {\n out[index] = item\n continue\n }\n\n const existingPath = cache.get(item as object)\n if (existingPath !== undefined) {\n out[index] = toRef(existingPath)\n continue\n }\n\n cache.set(item as object, itemPath)\n\n const childResult: unknown = Array.isArray(item) ? new Array((item as unknown[]).length) : {}\n out[index] = childResult\n queue.enqueue({ node: item as object, result: childResult, path: itemPath })\n }\n\n continue\n }\n\n // Handle objects - create a new object with processed values\n const out = result as Record<string, unknown>\n for (const [key, value] of Object.entries(node)) {\n const valuePath = `${path}/${escapeJsonPointer(key)}`\n\n if (typeof value !== 'object' || value === null) {\n out[key] = value\n continue\n }\n\n const existingPath = cache.get(value as object)\n if (existingPath !== undefined) {\n out[key] = toRef(existingPath)\n continue\n }\n\n cache.set(value as object, valuePath)\n\n const childResult: unknown = Array.isArray(value) ? new Array((value as unknown[]).length) : {}\n out[key] = childResult\n queue.enqueue({ node: value as object, result: childResult, path: valuePath })\n }\n }\n\n return rootResult as T\n}\n"],
5
- "mappings": "AAAA,SAAS,yBAAyB;AAClC,SAAS,aAAa;AAmBf,MAAM,mBAAmB,CAAI,KAAQ,UAAiC,CAAC,MAAS;AACrF,QAAM,EAAE,SAAS,IAAI,QAAQ,oBAAI,QAAwB,EAAE,IAAI;AAE/D,QAAM,QAAQ,CAAC,UAA8B,EAAE,MAAM,IAAI,QAAQ,EAAE,GAAG;AAGtE,MAAI,OAAO,QAAQ,YAAY,QAAQ,MAAM;AAC3C,WAAO;AAAA,EACT;AAEA,QAAM,WAAW;AACjB,QAAM,IAAI,KAAe,QAAQ;AAEjC,QAAM,aAAsB,MAAM,QAAQ,GAAG,IAAI,IAAI,MAAO,IAAkB,MAAM,IAAI,CAAC;AAEzF,QAAM,QAAQ,IAAI,MAAuD;AACzE,QAAM,QAAQ,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,YAAY;AAC7B;AAAA,MACF;AAEA,YAAM,IAAI,OAAiB,SAAS;AAEpC,YAAM,cAAuB,MAAM,QAAQ,KAAK,IAAI,IAAI,MAAO,MAAoB,MAAM,IAAI,CAAC;AAC9F,UAAI,GAAG,IAAI;AACX,YAAM,QAAQ,EAAE,MAAM,OAAiB,QAAQ,aAAa,MAAM,UAAU,CAAC;AAAA,IAC/E;AAAA,EACF;AAEA,SAAO;AACT;",
6
- "names": ["out"]
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/queue/queue.ts"],
4
- "sourcesContent": ["/**\n * Represents a node in a singly linked list structure, used internally by the Queue.\n *\n * Example:\n * const node = new Node<number>(42);\n * console.log(node.data); // 42\n * console.log(node.next); // null\n */\nexport class Node<T> {\n data: T\n next: Node<T> | null\n constructor(data: T) {\n this.data = data\n this.next = null\n }\n}\n\n/**\n * A generic queue implementation using a singly linked list.\n *\n * Example usage:\n *\n * const q = new Queue<number>();\n * q.enqueue(1);\n * q.enqueue(2);\n * q.enqueue(3);\n * console.log(q.dequeue()); // 1\n * console.log(q.peek()); // 2\n * console.log(q.getSize()); // 2\n * console.log(q.toString()); // \"2 -> 3\"\n * console.log(q.isEmpty()); // false\n */\n\nexport class Queue<T> {\n front: Node<T> | null\n rear: Node<T> | null\n size: number\n\n constructor() {\n this.front = null\n this.rear = null\n this.size = 0\n }\n\n /**\n * Adds an element to the end of the queue.\n * @param data - The data to add to the queue.\n */\n enqueue(data: T) {\n const newNode = new Node(data)\n if (this.isEmpty() || !this.rear) {\n this.front = newNode\n this.rear = newNode\n } else {\n this.rear.next = newNode\n this.rear = newNode\n }\n this.size++\n }\n\n /**\n * Removes and returns the front element of the queue.\n * @returns The data from the removed node, or null if the queue is empty.\n */\n dequeue() {\n if (this.isEmpty() || !this.front) {\n return null\n }\n const removedNode = this.front\n this.front = this.front.next\n if (this.front === null) {\n this.rear = null\n }\n this.size--\n return removedNode.data\n }\n\n /**\n * Returns the front element of the queue without removing it.\n * @returns The front data, or null if the queue is empty.\n */\n peek() {\n if (this.isEmpty() || !this.front) {\n return null\n }\n return this.front.data\n }\n\n /**\n * Checks whether the queue is empty.\n * @returns True if the queue has no elements, false otherwise.\n */\n isEmpty() {\n return this.size === 0\n }\n\n /**\n * Returns the number of elements in the queue.\n * @returns The size of the queue.\n */\n getSize() {\n return this.size\n }\n\n /**\n * Returns a string representation of the queue.\n * @returns Elements of the queue separated by ' -> '.\n */\n toString() {\n let current = this.front\n const elements = []\n while (current) {\n elements.push(current.data)\n current = current.next\n }\n return elements.join(' -> ')\n }\n}\n"],
5
- "mappings": "AAQO,MAAM,KAAQ;AAAA,EACnB;AAAA,EACA;AAAA,EACA,YAAY,MAAS;AACnB,SAAK,OAAO;AACZ,SAAK,OAAO;AAAA,EACd;AACF;AAkBO,MAAM,MAAS;AAAA,EACpB;AAAA,EACA;AAAA,EACA;AAAA,EAEA,cAAc;AACZ,SAAK,QAAQ;AACb,SAAK,OAAO;AACZ,SAAK,OAAO;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,QAAQ,MAAS;AACf,UAAM,UAAU,IAAI,KAAK,IAAI;AAC7B,QAAI,KAAK,QAAQ,KAAK,CAAC,KAAK,MAAM;AAChC,WAAK,QAAQ;AACb,WAAK,OAAO;AAAA,IACd,OAAO;AACL,WAAK,KAAK,OAAO;AACjB,WAAK,OAAO;AAAA,IACd;AACA,SAAK;AAAA,EACP;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,UAAU;AACR,QAAI,KAAK,QAAQ,KAAK,CAAC,KAAK,OAAO;AACjC,aAAO;AAAA,IACT;AACA,UAAM,cAAc,KAAK;AACzB,SAAK,QAAQ,KAAK,MAAM;AACxB,QAAI,KAAK,UAAU,MAAM;AACvB,WAAK,OAAO;AAAA,IACd;AACA,SAAK;AACL,WAAO,YAAY;AAAA,EACrB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,OAAO;AACL,QAAI,KAAK,QAAQ,KAAK,CAAC,KAAK,OAAO;AACjC,aAAO;AAAA,IACT;AACA,WAAO,KAAK,MAAM;AAAA,EACpB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,UAAU;AACR,WAAO,KAAK,SAAS;AAAA,EACvB;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,UAAU;AACR,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,WAAW;AACT,QAAI,UAAU,KAAK;AACnB,UAAM,WAAW,CAAC;AAClB,WAAO,SAAS;AACd,eAAS,KAAK,QAAQ,IAAI;AAC1B,gBAAU,QAAQ;AAAA,IACpB;AACA,WAAO,SAAS,KAAK,MAAM;AAAA,EAC7B;AACF;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/regex/find-variables.ts"],
4
- "sourcesContent": ["import { REGEX } from './regex-helpers'\n\n/**\n * Find all strings wrapped in {} or {{}} in value.\n *\n * @param value - The string to find variables in\n * @param includePath - Whether to include path variables {single}\n * @param includeEnv - Whether to include environment variables {{double}}\n */\nexport const findVariables = (\n value: string,\n { includePath = true, includeEnv = true }: { includePath?: boolean; includeEnv?: boolean } = {},\n): string[] =>\n [includePath && REGEX.PATH, includeEnv && REGEX.VARIABLES].flatMap((regex) =>\n regex\n ? [...value.matchAll(regex)]\n .map((match) => match[1]?.trim())\n .filter((variable): variable is string => variable !== undefined)\n : [],\n )\n"],
5
- "mappings": "AAAA,SAAS,aAAa;AASf,MAAM,gBAAgB,CAC3B,OACA,EAAE,cAAc,MAAM,aAAa,KAAK,IAAqD,CAAC,MAE9F,CAAC,eAAe,MAAM,MAAM,cAAc,MAAM,SAAS,EAAE;AAAA,EAAQ,CAAC,UAClE,QACI,CAAC,GAAG,MAAM,SAAS,KAAK,CAAC,EACtB,IAAI,CAAC,UAAU,MAAM,CAAC,GAAG,KAAK,CAAC,EAC/B,OAAO,CAAC,aAAiC,aAAa,MAAS,IAClE,CAAC;AACP;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/regex/regex-helpers.ts"],
4
- "sourcesContent": ["/**\n * Collection of regular expressions used throughout the application.\n * These patterns handle URL parsing, variable detection, and reference path extraction.\n */\nexport const REGEX = {\n /** Checks for a valid scheme */\n PROTOCOL: /^(?:https?|ftp|file|mailto|tel|data|wss?)*:\\/\\//,\n /** Finds multiple slashes after the scheme to replace with a single slash */\n MULTIPLE_SLASHES: /(?<!:)\\/{2,}/g,\n /** Finds all variables wrapped in {{double}} */\n VARIABLES: /{{((?:[^{}]|{[^{}]*})*)}}/g,\n /** Finds all variables wrapped in {single} */\n PATH: /(?:{)([^{}]+)}(?!})/g,\n /** Finds the name of the schema from the ref path */\n REF_NAME: /\\/([^\\/]+)$/,\n /** Finds template variables in multiple formats: {{var}}, {var}, or :var */\n TEMPLATE_VARIABLE: /{{\\s*([^}\\s]+?)\\s*}}|{\\s*([^}\\s]+?)\\s*}|:\\b[\\w.]+\\b/g,\n} as const\n"],
5
- "mappings": "AAIO,MAAM,QAAQ;AAAA;AAAA,EAEnB,UAAU;AAAA;AAAA,EAEV,kBAAkB;AAAA;AAAA,EAElB,WAAW;AAAA;AAAA,EAEX,MAAM;AAAA;AAAA,EAEN,UAAU;AAAA;AAAA,EAEV,mBAAmB;AACrB;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/regex/replace-variables.ts"],
4
- "sourcesContent": ["import { REGEX } from '@/regex/regex-helpers'\n\n/**\n * This function takes a string and replaces both {single} and {{double}} curly brace variables with given values.\n * Use the replacePathVariables and replaceEnvVariables functions if you only need to replace one type of variable.\n */\nexport function replaceVariables(\n value: string,\n variablesOrCallback: Record<string, string | number> | ((match: string) => string),\n) {\n // Replace all variables (example: {{ baseurl }} with an HTML tag)\n const doubleCurlyBrackets = /{{\\s*([\\w.-]+)\\s*}}/g\n const singleCurlyBrackets = /{\\s*([\\w.-]+)\\s*}/g\n\n const callback = (_: string, match: string): string => {\n if (typeof variablesOrCallback === 'function') {\n return variablesOrCallback(match)\n }\n return variablesOrCallback[match]?.toString() || `{${match}}`\n }\n\n // Loop through all matches and replace the match with the variable value\n return value.replace(doubleCurlyBrackets, callback).replace(singleCurlyBrackets, callback)\n}\n\n/** Replace {path} variables with their values */\nexport const replacePathVariables = (path: string, variables: Record<string, string> = {}) =>\n path.replace(REGEX.PATH, (match, key) => variables[key] ?? match)\n\n/** Replace {{env}} variables with their values */\nexport const replaceEnvVariables = (path: string, variables: Record<string, string> = {}) =>\n path.replace(REGEX.VARIABLES, (match, key) => variables[key] ?? match)\n"],
5
- "mappings": "AAAA,SAAS,aAAa;AAMf,SAAS,iBACd,OACA,qBACA;AAEA,QAAM,sBAAsB;AAC5B,QAAM,sBAAsB;AAE5B,QAAM,WAAW,CAAC,GAAW,UAA0B;AACrD,QAAI,OAAO,wBAAwB,YAAY;AAC7C,aAAO,oBAAoB,KAAK;AAAA,IAClC;AACA,WAAO,oBAAoB,KAAK,GAAG,SAAS,KAAK,IAAI,KAAK;AAAA,EAC5D;AAGA,SAAO,MAAM,QAAQ,qBAAqB,QAAQ,EAAE,QAAQ,qBAAqB,QAAQ;AAC3F;AAGO,MAAM,uBAAuB,CAAC,MAAc,YAAoC,CAAC,MACtF,KAAK,QAAQ,MAAM,MAAM,CAAC,OAAO,QAAQ,UAAU,GAAG,KAAK,KAAK;AAG3D,MAAM,sBAAsB,CAAC,MAAc,YAAoC,CAAC,MACrF,KAAK,QAAQ,MAAM,WAAW,CAAC,OAAO,QAAQ,UAAU,GAAG,KAAK,KAAK;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/string/camel-to-title.ts"],
4
- "sourcesContent": ["/**\n * Converts a camelCase string to Title Words with spaces\n *\n * @param camelStr - MUST be in camelCase or this might not work\n */\nexport const camelToTitleWords = (camelStr = '') =>\n camelStr\n .replace(/([A-Z]{2,})/g, ' $1') // Add space before consecutive capitals\n .replace(/([A-Z])(?=[a-z])/g, ' $1') // Add space before single capital followed by lowercase\n .replace(/^./, (str) => str.toUpperCase()) // Capitalize first letter\n .trim()\n"],
5
- "mappings": "AAKO,MAAM,oBAAoB,CAAC,WAAW,OAC3C,SACG,QAAQ,gBAAgB,KAAK,EAC7B,QAAQ,qBAAqB,KAAK,EAClC,QAAQ,MAAM,CAAC,QAAQ,IAAI,YAAY,CAAC,EACxC,KAAK;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/string/capitalize.ts"],
4
- "sourcesContent": ["/**\n * Capitalize first letter\n * You should normally do this in css, only use this if you have to\n */\nexport const capitalize = (str = '') => (str[0]?.toUpperCase() ?? '') + str.slice(1)\n"],
5
- "mappings": "AAIO,MAAM,aAAa,CAAC,MAAM,QAAQ,IAAI,CAAC,GAAG,YAAY,KAAK,MAAM,IAAI,MAAM,CAAC;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/string/create-hash.ts"],
4
- "sourcesContent": ["/**\n * Simple 32 bit non-secure hash from a string input\n *\n * @deprecated Please use generateHash from ./generate-hash.ts instead\n *\n * @see https://stackoverflow.com/a/7616484/1624255\n */\nexport const createHash = (input?: string): number => {\n let chr = 0\n let hash = 0\n let i = 0\n\n if (!input?.length) {\n return hash\n }\n\n for (i = 0; i < input.length; i++) {\n chr = input.charCodeAt(i)\n hash = (hash << 5) - hash + chr\n hash |= 0 // Convert to 32bit integer\n }\n return hash\n}\n"],
5
- "mappings": "AAOO,MAAM,aAAa,CAAC,UAA2B;AACpD,MAAI,MAAM;AACV,MAAI,OAAO;AACX,MAAI,IAAI;AAER,MAAI,CAAC,OAAO,QAAQ;AAClB,WAAO;AAAA,EACT;AAEA,OAAK,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACjC,UAAM,MAAM,WAAW,CAAC;AACxB,YAAQ,QAAQ,KAAK,OAAO;AAC5B,YAAQ;AAAA,EACV;AACA,SAAO;AACT;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/string/generate-hash.ts"],
4
- "sourcesContent": ["/**\n * MurmurHash3 implementation\n *\n * Generate a hash from a string using the MurmurHash3 algorithm\n * Provides 64-bit hash output with excellent speed and distribution\n *\n * We had to move away from xxhash-wasm since it was causing issues with content security policy (CSP) violations.\n *\n * We cannot use crypto.subtle because it is only available in secure contexts (HTTPS) or on localhost.\n *\n * @param input - The string to hash\n * @returns The 64-bit hash of the input string as a 16-character hex string\n */\nexport const generateHash = (input: string): string => {\n const seed = 0\n\n // Working with 64-bit values using pairs of 32-bit integers\n let h1 = seed\n let h2 = seed\n\n const len = input.length\n const remainder = len & 15 // len % 16\n const bytes = len - remainder\n\n const c1 = 0x87c37b91\n const c2 = 0x4cf5ad43\n const c3 = 0x52dce729\n const c4 = 0x38495ab5\n\n // Process 16-byte chunks\n for (let i = 0; i < bytes; i += 16) {\n let k1 =\n (input.charCodeAt(i) & 0xff) |\n ((input.charCodeAt(i + 1) & 0xff) << 8) |\n ((input.charCodeAt(i + 2) & 0xff) << 16) |\n ((input.charCodeAt(i + 3) & 0xff) << 24)\n\n let k2 =\n (input.charCodeAt(i + 4) & 0xff) |\n ((input.charCodeAt(i + 5) & 0xff) << 8) |\n ((input.charCodeAt(i + 6) & 0xff) << 16) |\n ((input.charCodeAt(i + 7) & 0xff) << 24)\n\n let k3 =\n (input.charCodeAt(i + 8) & 0xff) |\n ((input.charCodeAt(i + 9) & 0xff) << 8) |\n ((input.charCodeAt(i + 10) & 0xff) << 16) |\n ((input.charCodeAt(i + 11) & 0xff) << 24)\n\n let k4 =\n (input.charCodeAt(i + 12) & 0xff) |\n ((input.charCodeAt(i + 13) & 0xff) << 8) |\n ((input.charCodeAt(i + 14) & 0xff) << 16) |\n ((input.charCodeAt(i + 15) & 0xff) << 24)\n\n k1 = Math.imul(k1, c1)\n k1 = (k1 << 15) | (k1 >>> 17)\n k1 = Math.imul(k1, c2)\n h1 ^= k1\n\n h1 = (h1 << 13) | (h1 >>> 19)\n h1 = Math.imul(h1, 5) + 0xe6546b64\n\n k2 = Math.imul(k2, c2)\n k2 = (k2 << 16) | (k2 >>> 16)\n k2 = Math.imul(k2, c3)\n h2 ^= k2\n\n h2 = (h2 << 17) | (h2 >>> 15)\n h2 = Math.imul(h2, 5) + 0x1b873593\n\n k3 = Math.imul(k3, c3)\n k3 = (k3 << 17) | (k3 >>> 15)\n k3 = Math.imul(k3, c4)\n h1 ^= k3\n\n h1 = (h1 << 15) | (h1 >>> 17)\n h1 = Math.imul(h1, 5) + 0x52dce729\n\n k4 = Math.imul(k4, c4)\n k4 = (k4 << 18) | (k4 >>> 14)\n k4 = Math.imul(k4, c1)\n h2 ^= k4\n\n h2 = (h2 << 13) | (h2 >>> 19)\n h2 = Math.imul(h2, 5) + 0x38495ab5\n }\n\n // Process remaining bytes\n if (remainder > 0) {\n let k1 = 0\n let k2 = 0\n let k3 = 0\n let k4 = 0\n\n if (remainder >= 15) {\n k4 ^= (input.charCodeAt(bytes + 14) & 0xff) << 16\n }\n if (remainder >= 14) {\n k4 ^= (input.charCodeAt(bytes + 13) & 0xff) << 8\n }\n if (remainder >= 13) {\n k4 ^= input.charCodeAt(bytes + 12) & 0xff\n k4 = Math.imul(k4, c4)\n k4 = (k4 << 18) | (k4 >>> 14)\n k4 = Math.imul(k4, c1)\n h2 ^= k4\n }\n\n if (remainder >= 12) {\n k3 ^= (input.charCodeAt(bytes + 11) & 0xff) << 24\n }\n if (remainder >= 11) {\n k3 ^= (input.charCodeAt(bytes + 10) & 0xff) << 16\n }\n if (remainder >= 10) {\n k3 ^= (input.charCodeAt(bytes + 9) & 0xff) << 8\n }\n if (remainder >= 9) {\n k3 ^= input.charCodeAt(bytes + 8) & 0xff\n k3 = Math.imul(k3, c3)\n k3 = (k3 << 17) | (k3 >>> 15)\n k3 = Math.imul(k3, c4)\n h1 ^= k3\n }\n\n if (remainder >= 8) {\n k2 ^= (input.charCodeAt(bytes + 7) & 0xff) << 24\n }\n if (remainder >= 7) {\n k2 ^= (input.charCodeAt(bytes + 6) & 0xff) << 16\n }\n if (remainder >= 6) {\n k2 ^= (input.charCodeAt(bytes + 5) & 0xff) << 8\n }\n if (remainder >= 5) {\n k2 ^= input.charCodeAt(bytes + 4) & 0xff\n k2 = Math.imul(k2, c2)\n k2 = (k2 << 16) | (k2 >>> 16)\n k2 = Math.imul(k2, c3)\n h2 ^= k2\n }\n\n if (remainder >= 4) {\n k1 ^= (input.charCodeAt(bytes + 3) & 0xff) << 24\n }\n if (remainder >= 3) {\n k1 ^= (input.charCodeAt(bytes + 2) & 0xff) << 16\n }\n if (remainder >= 2) {\n k1 ^= (input.charCodeAt(bytes + 1) & 0xff) << 8\n }\n if (remainder >= 1) {\n k1 ^= input.charCodeAt(bytes) & 0xff\n k1 = Math.imul(k1, c1)\n k1 = (k1 << 15) | (k1 >>> 17)\n k1 = Math.imul(k1, c2)\n h1 ^= k1\n }\n }\n\n // Finalization\n h1 ^= len\n h2 ^= len\n\n h1 += h2\n h2 += h1\n\n h1 ^= h1 >>> 16\n h1 = Math.imul(h1, 0x85ebca6b)\n h1 ^= h1 >>> 13\n h1 = Math.imul(h1, 0xc2b2ae35)\n h1 ^= h1 >>> 16\n\n h2 ^= h2 >>> 16\n h2 = Math.imul(h2, 0x85ebca6b)\n h2 ^= h2 >>> 13\n h2 = Math.imul(h2, 0xc2b2ae35)\n h2 ^= h2 >>> 16\n\n h1 += h2\n h2 += h1\n\n // Return 64-bit hash as hex string (two 32-bit values concatenated)\n return (h1 >>> 0).toString(16).padStart(8, '0') + (h2 >>> 0).toString(16).padStart(8, '0')\n}\n"],
5
- "mappings": "AAaO,MAAM,eAAe,CAAC,UAA0B;AACrD,QAAM,OAAO;AAGb,MAAI,KAAK;AACT,MAAI,KAAK;AAET,QAAM,MAAM,MAAM;AAClB,QAAM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B,QAAM,OAAO;AAEb,QAAM;AACN,QAAM;AAGN,UAAQ,OAAO,GAAG,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG,KAAK,OAAO,GAAG,SAAS,EAAE,EAAE,SAAS,GAAG,GAAG;AAC3F;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/string/iterate-title.ts"],
4
- "sourcesContent": ["/**\n * Check for duplicate titles, and iterate title\n */\nexport const iterateTitle = (title: string, checkDuplicates: (title: string) => boolean, separator = ' #'): string => {\n // If the title is not a duplicate return\n if (!checkDuplicates(title)) {\n return title\n }\n\n const split = title.split(separator)\n const newTitle =\n split.length > 1\n ? `${split.slice(0, -1).join()}${separator}${Number(split.at(-1)) + 1}`\n : `${split.join()}${separator}2`\n\n return iterateTitle(newTitle, checkDuplicates, separator)\n}\n"],
5
- "mappings": "AAGO,MAAM,eAAe,CAAC,OAAe,iBAA6C,YAAY,SAAiB;AAEpH,MAAI,CAAC,gBAAgB,KAAK,GAAG;AAC3B,WAAO;AAAA,EACT;AAEA,QAAM,QAAQ,MAAM,MAAM,SAAS;AACnC,QAAM,WACJ,MAAM,SAAS,IACX,GAAG,MAAM,MAAM,GAAG,EAAE,EAAE,KAAK,CAAC,GAAG,SAAS,GAAG,OAAO,MAAM,GAAG,EAAE,CAAC,IAAI,CAAC,KACnE,GAAG,MAAM,KAAK,CAAC,GAAG,SAAS;AAEjC,SAAO,aAAa,UAAU,iBAAiB,SAAS;AAC1D;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/string/truncate.ts"],
4
- "sourcesContent": ["/**\n * Truncates a string to a specified length and adds an ellipsis if it's longer in JS\n *\n * @param str - The string to truncate\n * @param maxLength - The maximum length before truncation (default: 18)\n * @returns The truncated string with ellipsis if needed\n *\n * @example\n * truncate('Very long name that needs truncation') // 'Very long name th\u2026'\n * truncate('Short') // 'Short'\n */\nexport const truncate = (str: string, maxLength = 18): string => {\n if (str.length <= maxLength) {\n return str\n }\n return str.slice(0, maxLength) + '\u2026'\n}\n"],
5
- "mappings": "AAWO,MAAM,WAAW,CAAC,KAAa,YAAY,OAAe;AAC/D,MAAI,IAAI,UAAU,WAAW;AAC3B,WAAO;AAAA,EACT;AACA,SAAO,IAAI,MAAM,GAAG,SAAS,IAAI;AACnC;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/testing/console-spies.ts"],
4
- "sourcesContent": ["import { vi } from 'vitest'\n\n/** Spy on console.warn */\nexport const consoleWarnSpy = vi.spyOn(console, 'warn')\nexport let isConsoleWarnEnabled = false\n\n/** Spy on console.error */\nexport const consoleErrorSpy = vi.spyOn(console, 'error')\nexport let isConsoleErrorEnabled = false\n\n/** Reset the spies */\nexport const resetConsoleSpies = () => {\n consoleWarnSpy.mockClear()\n consoleErrorSpy.mockClear()\n}\n\n/** Helper to re-enable console warn checks */\nexport const enableConsoleWarn = () => (isConsoleWarnEnabled = true)\n\n/** Helper to disable console warn checks */\nexport const disableConsoleWarn = () => (isConsoleWarnEnabled = false)\n\n/** Helper to enable console error checks */\nexport const enableConsoleError = () => (isConsoleErrorEnabled = true)\n\n/** Helper to disable console error checks */\nexport const disableConsoleError = () => (isConsoleErrorEnabled = false)\n"],
5
- "mappings": "AAAA,SAAS,UAAU;AAGZ,MAAM,iBAAiB,GAAG,MAAM,SAAS,MAAM;AAC/C,IAAI,uBAAuB;AAG3B,MAAM,kBAAkB,GAAG,MAAM,SAAS,OAAO;AACjD,IAAI,wBAAwB;AAG5B,MAAM,oBAAoB,MAAM;AACrC,iBAAe,UAAU;AACzB,kBAAgB,UAAU;AAC5B;AAGO,MAAM,oBAAoB,MAAO,uBAAuB;AAGxD,MAAM,qBAAqB,MAAO,uBAAuB;AAGzD,MAAM,qBAAqB,MAAO,wBAAwB;AAG1D,MAAM,sBAAsB,MAAO,wBAAwB;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/testing/measure.ts"],
4
- "sourcesContent": ["/**\n * Measures the execution time of a function and logs it.\n *\n * Works only with sync functions and returns the result of the measured function.\n *\n * @example\n *\n * ```ts\n * // Sync function\n * const result = measureSync('computation', () => {\n * return heavyComputation()\n * })\n * ```\n */\nexport const measureSync = <F extends () => unknown>(\n name: string,\n fn: ReturnType<F> extends Promise<unknown> ? never : F,\n): ReturnType<F> => {\n const start = performance.now()\n\n const result = fn()\n\n const end = performance.now()\n const duration = Math.round(end - start)\n\n console.info(`${name}: ${duration} ms`)\n\n return result as ReturnType<F>\n}\n\n/**\n * Measures the execution time of an async function and logs it.\n *\n * Works only with async functions and returns the result of the measured function.\n *\n * @example\n *\n * ```ts\n * // Async function\n * const result = await measure('api-call', async () => {\n * return await fetchData()\n * })\n * ````\n */\nexport const measureAsync = async <T>(name: string, fn: () => Promise<T>): Promise<T> => {\n const start = performance.now()\n\n const result = await fn()\n\n const end = performance.now()\n const duration = Math.round(end - start)\n\n console.info(`${name}: ${duration} ms`)\n\n return result\n}\n"],
5
- "mappings": "AAcO,MAAM,cAAc,CACzB,MACA,OACkB;AAClB,QAAM,QAAQ,YAAY,IAAI;AAE9B,QAAM,SAAS,GAAG;AAElB,QAAM,MAAM,YAAY,IAAI;AAC5B,QAAM,WAAW,KAAK,MAAM,MAAM,KAAK;AAEvC,UAAQ,KAAK,GAAG,IAAI,KAAK,QAAQ,KAAK;AAEtC,SAAO;AACT;AAgBO,MAAM,eAAe,OAAU,MAAc,OAAqC;AACvF,QAAM,QAAQ,YAAY,IAAI;AAE9B,QAAM,SAAS,MAAM,GAAG;AAExB,QAAM,MAAM,YAAY,IAAI;AAC5B,QAAM,WAAW,KAAK,MAAM,MAAM,KAAK;AAEvC,UAAQ,KAAK,GAAG,IAAI,KAAK,QAAQ,KAAK;AAEtC,SAAO;AACT;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/testing/measure.test-d.ts"],
4
- "sourcesContent": ["import { describe, vi } from 'vitest'\n\nimport { measureAsync, measureSync } from './measure'\n\nconst asyncFunction = vi.fn<() => Promise<number>>()\n\ndescribe('measureAsync types', async () => {\n // works with async methods\n await measureAsync('test', asyncFunction)\n\n // @ts-expect-error should error because `fn` doesn't return a Promise\n await measureAsync('test', () => 1)\n})\n\ndescribe('measureSync types', () => {\n // works with sync methods\n measureSync('test', () => 1)\n\n // @ts-expect-error should error because `fn` doesn't return a Promise\n measureSync('test', asyncFunction)\n})\n"],
5
- "mappings": "AAAA,SAAS,UAAU,UAAU;AAE7B,SAAS,cAAc,mBAAmB;AAE1C,MAAM,gBAAgB,GAAG,GAA0B;AAEnD,SAAS,sBAAsB,YAAY;AAEzC,QAAM,aAAa,QAAQ,aAAa;AAGxC,QAAM,aAAa,QAAQ,MAAM,CAAC;AACpC,CAAC;AAED,SAAS,qBAAqB,MAAM;AAElC,cAAY,QAAQ,MAAM,CAAC;AAG3B,cAAY,QAAQ,aAAa;AACnC,CAAC;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/testing/sleep.ts"],
4
- "sourcesContent": ["/**\n * Little helper for sleeping for x milliseconds\n * an async await friendly setTimeout\n */\nexport const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms))\n"],
5
- "mappings": "AAIO,MAAM,QAAQ,CAAC,OAAe,IAAI,QAAQ,CAAC,MAAM,WAAW,GAAG,EAAE,CAAC;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/url/ensure-protocol.ts"],
4
- "sourcesContent": ["import { REGEX } from '@/regex/regex-helpers'\n\n/** Ensure URL has a protocol prefix */\nexport function ensureProtocol(url: string): string {\n if (REGEX.PROTOCOL.test(url)) {\n return url\n }\n\n // Default to http if no protocol is specified\n return `http://${url.replace(/^\\//, '')}`\n}\n"],
5
- "mappings": "AAAA,SAAS,aAAa;AAGf,SAAS,eAAe,KAAqB;AAClD,MAAI,MAAM,SAAS,KAAK,GAAG,GAAG;AAC5B,WAAO;AAAA,EACT;AAGA,SAAO,UAAU,IAAI,QAAQ,OAAO,EAAE,CAAC;AACzC;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/url/extract-server-from-path.ts"],
4
- "sourcesContent": ["/**\n * Extracts the server from a string, used to check for servers in paths during migration\n *\n * @param path - The URL string to parse. If no protocol is provided, the URL API will throw an error.\n * @returns A tuple of [origin, remainingPath] or null if the input is empty, whitespace-only, or invalid.\n *\n * @example\n * extractServer('https://api.example.com/v1/users?id=123')\n * // Returns: ['https://api.example.com', '/v1/users?id=123']\n *\n * @example\n * extractServer('/users')\n * // Returns: null\n *\n * @example\n * extractServer('/users')\n * // Returns: null\n *\n * @example\n * extractServer('//api.example.com/v1/users')\n * // Returns: ['//api.example.com', '/v1/users']\n */\nexport const extractServerFromPath = (path = ''): [string, string] | null => {\n if (!path.trim()) {\n return null\n }\n\n /** Handle protocol-relative URLs (e.g., \"//api.example.com\") */\n if (path.startsWith('//')) {\n try {\n /** Use dummy protocol to parse, then strip it */\n const url = new URL(`https:${path}`)\n if (url.origin === 'null') {\n return null\n }\n const origin = url.origin.replace(/^https?:/, '')\n\n /** Decode pathname to preserve OpenAPI template variables like {userId} */\n const remainingPath = decodeURIComponent(url.pathname) + url.search + url.hash\n return [origin, remainingPath]\n } catch {\n return null\n }\n }\n\n try {\n const url = new URL(path)\n /** URL API returns \"null\" for file:// and other invalid protocols */\n if (url.origin === 'null') {\n return null\n }\n /** Decode pathname to preserve OpenAPI template variables like {userId} */\n const remainingPath = decodeURIComponent(url.pathname) + url.search + url.hash\n return [url.origin, remainingPath]\n } catch {\n return null\n }\n}\n"],
5
- "mappings": "AAsBO,MAAM,wBAAwB,CAAC,OAAO,OAAgC;AAC3E,MAAI,CAAC,KAAK,KAAK,GAAG;AAChB,WAAO;AAAA,EACT;AAGA,MAAI,KAAK,WAAW,IAAI,GAAG;AACzB,QAAI;AAEF,YAAM,MAAM,IAAI,IAAI,SAAS,IAAI,EAAE;AACnC,UAAI,IAAI,WAAW,QAAQ;AACzB,eAAO;AAAA,MACT;AACA,YAAM,SAAS,IAAI,OAAO,QAAQ,YAAY,EAAE;AAGhD,YAAM,gBAAgB,mBAAmB,IAAI,QAAQ,IAAI,IAAI,SAAS,IAAI;AAC1E,aAAO,CAAC,QAAQ,aAAa;AAAA,IAC/B,QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AAEA,MAAI;AACF,UAAM,MAAM,IAAI,IAAI,IAAI;AAExB,QAAI,IAAI,WAAW,QAAQ;AACzB,aAAO;AAAA,IACT;AAEA,UAAM,gBAAgB,mBAAmB,IAAI,QAAQ,IAAI,IAAI,SAAS,IAAI;AAC1E,WAAO,CAAC,IAAI,QAAQ,aAAa;AAAA,EACnC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/url/is-local-url.ts"],
4
- "sourcesContent": ["/** Obviously local hostnames */\nconst LOCAL_HOSTNAMES = ['localhost', '127.0.0.1', '[::1]', '0.0.0.0']\n\n/** Reserved TLDs that are guaranteed to never be assigned */\nconst RESERVED_TLDS = ['test', 'example', 'invalid', 'localhost']\n\n/**\n * Detect requests to localhost or reserved TLDs\n */\nexport function isLocalUrl(url: string) {\n try {\n const { hostname } = new URL(url)\n\n // Check if hostname is in the local hostnames list\n if (LOCAL_HOSTNAMES.includes(hostname)) {\n return true\n }\n\n // Check if hostname ends with a reserved TLD\n const tld = hostname.split('.').pop()\n if (tld && RESERVED_TLDS.includes(tld)) {\n return true\n }\n\n return false\n } catch {\n // If it's not a valid URL, we can't use the proxy anyway,\n // but it also covers cases like relative URLs (e.g. `openapi.json`).\n return true\n }\n}\n"],
5
- "mappings": "AACA,MAAM,kBAAkB,CAAC,aAAa,aAAa,SAAS,SAAS;AAGrE,MAAM,gBAAgB,CAAC,QAAQ,WAAW,WAAW,WAAW;AAKzD,SAAS,WAAW,KAAa;AACtC,MAAI;AACF,UAAM,EAAE,SAAS,IAAI,IAAI,IAAI,GAAG;AAGhC,QAAI,gBAAgB,SAAS,QAAQ,GAAG;AACtC,aAAO;AAAA,IACT;AAGA,UAAM,MAAM,SAAS,MAAM,GAAG,EAAE,IAAI;AACpC,QAAI,OAAO,cAAc,SAAS,GAAG,GAAG;AACtC,aAAO;AAAA,IACT;AAEA,WAAO;AAAA,EACT,QAAQ;AAGN,WAAO;AAAA,EACT;AACF;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/url/is-relative-path.ts"],
4
- "sourcesContent": ["import { REGEX } from '@/regex/regex-helpers'\n\n/**\n * Check if the URL is relative or if it's a domain without protocol\n **/\nexport const isRelativePath = (url: string) => {\n // Allow http:// https:// and other protocols such as file://\n if (REGEX.PROTOCOL.test(url)) {\n return false\n }\n\n // Check if it looks like a domain (contains dots and no spaces)\n // This catches cases like \"galaxy.scalar.com/planets\"\n if (/^[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+(\\/|$)/.test(url)) {\n return false\n }\n\n return true\n}\n"],
5
- "mappings": "AAAA,SAAS,aAAa;AAKf,MAAM,iBAAiB,CAAC,QAAgB;AAE7C,MAAI,MAAM,SAAS,KAAK,GAAG,GAAG;AAC5B,WAAO;AAAA,EACT;AAIA,MAAI,uCAAuC,KAAK,GAAG,GAAG;AACpD,WAAO;AAAA,EACT;AAEA,SAAO;AACT;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/url/is-valid-url.ts"],
4
- "sourcesContent": ["/**\n * Checks if a given string is a valid URL.\n *\n * @param {string} url - The string to be validated as a URL.\n * @returns {boolean} Returns true if the string is a valid URL, false otherwise.\n *\n * @example\n * isValidUrl('https://www.example.com'); // returns true\n * isValidUrl('not a url'); // returns false\n */\nexport function isValidUrl(url: string) {\n try {\n return Boolean(new URL(url))\n } catch {\n return false\n }\n}\n"],
5
- "mappings": "AAUO,SAAS,WAAW,KAAa;AACtC,MAAI;AACF,WAAO,QAAQ,IAAI,IAAI,GAAG,CAAC;AAAA,EAC7B,QAAQ;AACN,WAAO;AAAA,EACT;AACF;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/url/make-url-absolute.ts"],
4
- "sourcesContent": ["import { combineUrlAndPath } from '@/url/merge-urls'\n\n/**\n * Converts a relative URL to an absolute URL using the provided base URL or current window location.\n * @param url - The URL to make absolute\n * @param options - Configuration options\n * @param options.baseUrl - Optional base URL to resolve against (defaults to window.location.href)\n * @param options.basePath - If provided, combines with baseUrl or window.location.origin before resolving\n * @returns The absolute URL, or the original URL if it's already absolute or invalid\n */\nexport const makeUrlAbsolute = (\n url: string,\n {\n /** Optional base URL to resolve against (defaults to window.location.href) */\n baseUrl,\n /** If we have a basePath then we resolve against window.location.origin + basePath */\n basePath,\n }: {\n baseUrl?: string\n basePath?: string\n } = {},\n): string => {\n // If no base URL provided and we're not in a browser environment, return as-is\n if (typeof window === 'undefined' && !baseUrl) {\n return url\n }\n\n try {\n // If we can create a URL object without a base, it's already absolute\n new URL(url)\n return url\n } catch {\n // URL is relative, proceed with resolution\n }\n\n // Use URL constructor which handles path normalization automatically\n try {\n let base = baseUrl || window.location.href\n\n // If basePath is provided, combine it with the base URL\n if (basePath) {\n const origin = baseUrl ? new URL(baseUrl).origin : window.location.origin\n base = combineUrlAndPath(origin, basePath + '/')\n }\n\n return new URL(url, base).toString()\n } catch {\n // If URL construction fails, return the original URL\n return url\n }\n}\n"],
5
- "mappings": "AAAA,SAAS,yBAAyB;AAU3B,MAAM,kBAAkB,CAC7B,KACA;AAAA;AAAA,EAEE;AAAA;AAAA,EAEA;AACF,IAGI,CAAC,MACM;AAEX,MAAI,OAAO,WAAW,eAAe,CAAC,SAAS;AAC7C,WAAO;AAAA,EACT;AAEA,MAAI;AAEF,QAAI,IAAI,GAAG;AACX,WAAO;AAAA,EACT,QAAQ;AAAA,EAER;AAGA,MAAI;AACF,QAAI,OAAO,WAAW,OAAO,SAAS;AAGtC,QAAI,UAAU;AACZ,YAAM,SAAS,UAAU,IAAI,IAAI,OAAO,EAAE,SAAS,OAAO,SAAS;AACnE,aAAO,kBAAkB,QAAQ,WAAW,GAAG;AAAA,IACjD;AAEA,WAAO,IAAI,IAAI,KAAK,IAAI,EAAE,SAAS;AAAA,EACrC,QAAQ;AAEN,WAAO;AAAA,EACT;AACF;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/url/merge-urls.ts"],
4
- "sourcesContent": ["import { REGEX } from '@/regex/regex-helpers'\nimport { isRelativePath } from './is-relative-path'\nimport { ensureProtocol } from './ensure-protocol'\n\n/**\n * Merges multiple URLSearchParams objects, preserving multiple values per param\n * within each source, but later sources overwrite earlier ones completely\n * This should de-dupe our query params while allowing multiple keys for \"arrays\"\n */\nexport const mergeSearchParams = (...params: URLSearchParams[]): URLSearchParams => {\n // We keep a merged record to ensure the next group will overwrite the previous\n const merged: Record<string, string | string[]> = {}\n\n // Loops over each group and grabs unique keys\n params.forEach((p) => {\n const keys = Array.from(p.keys())\n const uniqueKeys = new Set(keys)\n\n uniqueKeys.forEach((key) => {\n const values = p.getAll(key)\n const value = values.length > 1 ? values : (values[0] ?? '')\n\n merged[key] = value\n })\n })\n\n const result = new URLSearchParams()\n\n // We maintain multiple values for each key if they existed\n Object.entries(merged).forEach(([key, value]) => {\n if (Array.isArray(value)) {\n value.forEach((v) => result.append(key, v))\n } else {\n result.append(key, value)\n }\n })\n\n return result\n}\n\n/** Combines a base URL and a path ensuring there's only one slash between them */\nexport const combineUrlAndPath = (url: string, path: string) => {\n if (!path || url === path) {\n return url.trim()\n }\n\n if (!url) {\n return path.trim()\n }\n\n return `${url.trim()}/${path.trim()}`.replace(REGEX.MULTIPLE_SLASHES, '/')\n}\n\n/**\n * Creates a URL from the path and server\n * also optionally merges query params if you include urlSearchParams\n * This was re-written without using URL to support variables in the scheme\n */\nexport const mergeUrls = (\n url: string,\n path: string,\n urlParams: URLSearchParams = new URLSearchParams(),\n /** To disable prefixing the url with the origin or a scheme*/\n disableOriginPrefix = false,\n) => {\n // Extract and merge all query params\n if (url && (!isRelativePath(url) || typeof window !== 'undefined')) {\n /** Prefix the url with the origin if it is relative and we wish to */\n const base = disableOriginPrefix\n ? url\n : isRelativePath(url)\n ? combineUrlAndPath(window.location.origin, url)\n : ensureProtocol(url)\n\n // Extract search params from base URL if any\n const [baseUrl = '', baseQuery] = base.split('?')\n const baseParams = new URLSearchParams(baseQuery || '')\n\n // Extract search params from path if any\n const [pathWithoutQuery = '', pathQuery] = path.split('?')\n const pathParams = new URLSearchParams(pathQuery || '')\n\n // Merge the baseUrl and path\n const mergedUrl = url === path ? baseUrl : combineUrlAndPath(baseUrl, pathWithoutQuery)\n\n // Merge all search params\n const mergedSearchParams = mergeSearchParams(baseParams, pathParams, urlParams)\n\n // Build the final URL\n const search = mergedSearchParams.toString()\n return search ? `${mergedUrl}?${search}` : mergedUrl\n }\n if (path) {\n return combineUrlAndPath(url, path)\n }\n return ''\n}\n"],
5
- "mappings": "AAAA,SAAS,aAAa;AACtB,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AAOxB,MAAM,oBAAoB,IAAI,WAA+C;AAElF,QAAM,SAA4C,CAAC;AAGnD,SAAO,QAAQ,CAAC,MAAM;AACpB,UAAM,OAAO,MAAM,KAAK,EAAE,KAAK,CAAC;AAChC,UAAM,aAAa,IAAI,IAAI,IAAI;AAE/B,eAAW,QAAQ,CAAC,QAAQ;AAC1B,YAAM,SAAS,EAAE,OAAO,GAAG;AAC3B,YAAM,QAAQ,OAAO,SAAS,IAAI,SAAU,OAAO,CAAC,KAAK;AAEzD,aAAO,GAAG,IAAI;AAAA,IAChB,C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AAK;AAAA,EAC7C;AACA,MAAI,MAAM;AACR,WAAO,kBAAkB,KAAK,IAAI;AAAA,EACpC;AACA,SAAO;AACT;",
6
- "names": []
7
- }
@@ -1,7 +0,0 @@
1
- {
2
- "version": 3,
3
- "sources": ["../../src/url/redirect-to-proxy.ts"],
4
- "sourcesContent": ["import { isLocalUrl } from './is-local-url'\nimport { isRelativePath } from './is-relative-path'\n\n/**\n * Redirects the request to a proxy server with a given URL. But not for:\n *\n * - Relative URLs\n * - URLs that seem to point to a local IP (except the proxy is on the same domain)\n * - URLs that don't look like a domain\n **/\nexport const redirectToProxy = (proxyUrl?: string, url?: string): string => {\n try {\n if (!shouldUseProxy(proxyUrl, url)) {\n return url ?? ''\n }\n\n // Create new URL object from url\n const newUrl = new URL(url)\n\n // Add temporary domain for relative proxy URLs\n //\n // Q: Why isn't proxyUrl type guarded?\n // A: Type guarding works for one parameter only (as of now).\n //\n // Q: Why do we need to add http://localhost to relative proxy URLs?\n // A: Because the `new URL()` would otherwise fail.\n //\n const temporaryProxyUrl = isRelativePath(proxyUrl as string) ? `http://localhost${proxyUrl}` : (proxyUrl as string)\n\n // Rewrite the URL with the proxy\n newUrl.href = temporaryProxyUrl\n\n // Add the original URL as a query parameter\n newUrl.searchParams.append('scalar_url', url)\n\n // Remove the temporary domain if we added it, but only from the start of the URL\n const result = isRelativePath(proxyUrl as string)\n ? newUrl.toString().replace(/^http:\\/\\/localhost/, '')\n : newUrl.toString()\n\n return result\n } catch {\n return url ?? ''\n }\n}\n\n/**\n * Returns false for requests to localhost, relative URLs, if no proxy is defined \u2026\n **/\nexport const shouldUseProxy = (proxyUrl?: string, url?: string): url is string => {\n try {\n // \u274C We don't have a proxy URL or the URL\n if (!proxyUrl || !url) {\n return false\n }\n\n // \u274C Request to relative URLs (won't be blocked by CORS anyway)\n if (isRelativePath(url)) {\n return false\n }\n\n // \u2705 Proxy URL is on the same domain (e.g. /proxy)\n // It's more likely (not guaranteed, though) that the proxy has access to local domains.\n if (isRelativePath(proxyUrl)) {\n return true\n }\n\n // \u2705 Proxy URL is local\n if (isLocalUrl(proxyUrl)) {\n return true\n }\n\n // \u274C Requests to localhost\n // We won't reach them from a (likely remote) proxy.\n if (isLocalUrl(url)) {\n return false\n }\n\n // \u2705 Seems fine (e.g. remote proxy + remote URL)\n return true\n } catch {\n return false\n }\n}\n"],
5
- "mappings": "AAAA,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AASxB,MAAM,kBAAkB,CAAC,UAAmB,QAAyB;AAC1E,MAAI;AACF,QAAI,CAAC,eAAe,UAAU,GAAG,GAAG;AAClC,aAAO,OAAO;AAAA,IAChB;AAGA,UAAM,SAAS,IAAI,IAAI,GAAG;AAU1B,UAAM,oBAAoB,eAAe,QAAkB,IAAI,mBAAmB,QAAQ,KAAM;AAGhG,WAAO,OAAO;AAGd,WAAO,aAAa,OAAO,cAAc,GAAG;AAG5C,UAAM,SAAS,eAAe,QAAkB,IAC5C,OAAO,SAAS,EAAE,QAAQ,uBAAuB,EAAE,IACnD,OAAO,SAAS;AAEpB,WAAO;AAAA,EACT,QAAQ;AACN,WAAO,OAAO;AAAA,EAChB;AACF;AAKO,MAAM,iBAAiB,CAAC,UAAmB,QAAgC;AAChF,MAAI;AAEF,QAAI,CAAC,YAAY,CAAC,KAAK;AACrB,aAAO;AAAA,IACT;AAGA,QAAI,eAAe,GAAG,GAAG;AACvB,aAAO;AAAA,IACT;AAIA,QAAI,eAAe,QAAQ,GAAG;AAC5B,aAAO;AAAA,IACT;AAGA,QAAI,WAAW,QAAQ,GAAG;AACxB,aAAO;AAAA,IACT;AAIA,QAAI,WAAW,GAAG,GAAG;AACnB,aAAO;AAAA,IACT;AAGA,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;",
6
- "names": []
7
- }