@scalar/helpers 0.4.1 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +13 -0
- package/dist/array/add-to-map-array.js +7 -8
- package/dist/array/is-defined.js +12 -5
- package/dist/array/sort-by-order.js +60 -18
- package/dist/consts/content-types.js +13 -14
- package/dist/dom/freeze-element.js +56 -42
- package/dist/dom/get-selector.d.ts +7 -0
- package/dist/dom/get-selector.d.ts.map +1 -0
- package/dist/dom/get-selector.js +31 -0
- package/dist/dom/scroll-to-id.js +33 -27
- package/dist/file/json2xml.js +79 -61
- package/dist/formatters/format-bytes.d.ts +7 -0
- package/dist/formatters/format-bytes.d.ts.map +1 -0
- package/dist/formatters/format-bytes.js +18 -0
- package/dist/formatters/format-milliseconds.d.ts +6 -0
- package/dist/formatters/format-milliseconds.d.ts.map +1 -0
- package/dist/formatters/format-milliseconds.js +10 -0
- package/dist/general/create-limiter.js +47 -31
- package/dist/general/debounce.js +86 -66
- package/dist/general/extract-config-secrets.js +29 -27
- package/dist/general/has-modifier.js +9 -8
- package/dist/general/is-mac-os.js +23 -21
- package/dist/http/can-method-have-body.js +4 -6
- package/dist/http/http-info.js +63 -61
- package/dist/http/http-methods.js +4 -7
- package/dist/http/http-status-codes.js +316 -320
- package/dist/http/is-http-method.js +3 -6
- package/dist/http/normalize-http-method.js +19 -19
- package/dist/json/escape-json-pointer.js +6 -5
- package/dist/json/parse-json-pointer-segments.js +11 -6
- package/dist/json/pretty-print-json.d.ts +9 -0
- package/dist/json/pretty-print-json.d.ts.map +1 -0
- package/dist/json/pretty-print-json.js +42 -0
- package/dist/json/unescape-json-pointer.js +7 -5
- package/dist/markdown/get-markdown-headings.d.ts +11 -0
- package/dist/markdown/get-markdown-headings.d.ts.map +1 -0
- package/dist/markdown/get-markdown-headings.js +99 -0
- package/dist/node/path.js +168 -138
- package/dist/object/get-value-at-path.js +17 -11
- package/dist/object/is-object.js +24 -10
- package/dist/object/local-storage.js +50 -42
- package/dist/object/object-entries.js +2 -5
- package/dist/object/object-keys.js +5 -5
- package/dist/object/object-replace.js +13 -12
- package/dist/object/omit-undefined-values.js +18 -18
- package/dist/object/prevent-pollution.js +27 -10
- package/dist/object/to-json-compatible.js +71 -62
- package/dist/queue/queue.js +103 -84
- package/dist/regex/find-variables.js +13 -8
- package/dist/regex/regex-helpers.js +17 -17
- package/dist/regex/replace-variables.js +21 -19
- package/dist/string/camel-to-title.js +10 -5
- package/dist/string/capitalize.js +5 -5
- package/dist/string/create-hash.js +19 -16
- package/dist/string/generate-hash.js +153 -127
- package/dist/string/iterate-title.js +13 -11
- package/dist/string/truncate.js +16 -9
- package/dist/testing/console-spies.js +19 -24
- package/dist/testing/measure.js +42 -19
- package/dist/testing/measure.test-d.js +12 -9
- package/dist/testing/sleep.js +5 -5
- package/dist/url/ensure-protocol.js +8 -10
- package/dist/url/extract-server-from-path.js +53 -28
- package/dist/url/is-local-url.js +24 -18
- package/dist/url/is-relative-path.js +15 -13
- package/dist/url/is-valid-url.js +17 -10
- package/dist/url/make-url-absolute.js +39 -28
- package/dist/url/merge-urls.js +74 -52
- package/dist/url/redirect-to-proxy.js +68 -39
- package/package.json +15 -9
- package/dist/array/add-to-map-array.js.map +0 -7
- package/dist/array/is-defined.js.map +0 -7
- package/dist/array/sort-by-order.js.map +0 -7
- package/dist/consts/content-types.js.map +0 -7
- package/dist/dom/freeze-element.js.map +0 -7
- package/dist/dom/scroll-to-id.js.map +0 -7
- package/dist/file/json2xml.js.map +0 -7
- package/dist/general/create-limiter.js.map +0 -7
- package/dist/general/debounce.js.map +0 -7
- package/dist/general/extract-config-secrets.js.map +0 -7
- package/dist/general/has-modifier.js.map +0 -7
- package/dist/general/is-mac-os.js.map +0 -7
- package/dist/http/can-method-have-body.js.map +0 -7
- package/dist/http/http-info.js.map +0 -7
- package/dist/http/http-methods.js.map +0 -7
- package/dist/http/http-status-codes.js.map +0 -7
- package/dist/http/is-http-method.js.map +0 -7
- package/dist/http/normalize-http-method.js.map +0 -7
- package/dist/json/escape-json-pointer.js.map +0 -7
- package/dist/json/parse-json-pointer-segments.js.map +0 -7
- package/dist/json/unescape-json-pointer.js.map +0 -7
- package/dist/node/path.js.map +0 -7
- package/dist/object/get-value-at-path.js.map +0 -7
- package/dist/object/is-object.js.map +0 -7
- package/dist/object/local-storage.js.map +0 -7
- package/dist/object/object-entries.js.map +0 -7
- package/dist/object/object-keys.js.map +0 -7
- package/dist/object/object-replace.js.map +0 -7
- package/dist/object/omit-undefined-values.js.map +0 -7
- package/dist/object/prevent-pollution.js.map +0 -7
- package/dist/object/to-json-compatible.js.map +0 -7
- package/dist/queue/queue.js.map +0 -7
- package/dist/regex/find-variables.js.map +0 -7
- package/dist/regex/regex-helpers.js.map +0 -7
- package/dist/regex/replace-variables.js.map +0 -7
- package/dist/string/camel-to-title.js.map +0 -7
- package/dist/string/capitalize.js.map +0 -7
- package/dist/string/create-hash.js.map +0 -7
- package/dist/string/generate-hash.js.map +0 -7
- package/dist/string/iterate-title.js.map +0 -7
- package/dist/string/truncate.js.map +0 -7
- package/dist/testing/console-spies.js.map +0 -7
- package/dist/testing/measure.js.map +0 -7
- package/dist/testing/measure.test-d.js.map +0 -7
- package/dist/testing/sleep.js.map +0 -7
- package/dist/url/ensure-protocol.js.map +0 -7
- package/dist/url/extract-server-from-path.js.map +0 -7
- package/dist/url/is-local-url.js.map +0 -7
- package/dist/url/is-relative-path.js.map +0 -7
- package/dist/url/is-valid-url.js.map +0 -7
- package/dist/url/make-url-absolute.js.map +0 -7
- package/dist/url/merge-urls.js.map +0 -7
- package/dist/url/redirect-to-proxy.js.map +0 -7
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/file/json2xml.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Character map for XML escaping to prevent XML injection attacks.\n */\nconst XML_ESCAPE_MAP: Record<string, string> = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n \"'\": ''',\n}\n\n/**\n * Escapes special XML characters to prevent injection attacks.\n */\nfunction escapeXml(str: string): string {\n return str.replace(/[&<>\"']/g, (char) => XML_ESCAPE_MAP[char] ?? char)\n}\n\n/**\n * This function converts an object to XML.\n * Values are automatically escaped to prevent XML injection attacks.\n */\nexport function json2xml(\n data: Record<string, any>,\n options: {\n indent?: string\n format?: boolean\n xmlDeclaration?: boolean\n } = {},\n) {\n const { indent = ' ', format = true, xmlDeclaration = true } = options\n\n const toXml = (value: any, key: string, currentIndent: string): string => {\n let xml = ''\n\n if (Array.isArray(value)) {\n for (let i = 0, n = value.length; i < n; i++) {\n xml += toXml(value[i], key, currentIndent)\n }\n } else if (typeof value === 'object' && value !== null) {\n let hasChild = false\n let attributes = ''\n let children = ''\n\n // Handle attributes (keys starting with @)\n for (const attr in value) {\n if (attr.charAt(0) === '@') {\n attributes += ' ' + attr.substr(1) + '=\"' + escapeXml(value[attr].toString()) + '\"'\n }\n }\n\n // Handle children and special content\n for (const child in value) {\n if (child === '#text') {\n children += escapeXml(value[child]?.toString() ?? '')\n } else if (child === '#cdata') {\n // Escape ]]> sequences to prevent CDATA injection\n const cdataContent = value[child]?.toString() ?? ''\n children += '<![CDATA[' + cdataContent.replace(/]]>/g, ']]]]><![CDATA[>') + ']]>'\n } else if (child.charAt(0) !== '@') {\n hasChild = true\n children += toXml(value[child], child, currentIndent + indent)\n }\n }\n\n if (hasChild || children) {\n xml += currentIndent + '<' + key + attributes + '>\\n'\n xml += children\n xml += currentIndent + '</' + key + '>\\n'\n } else {\n xml += currentIndent + '<' + key + attributes + '/>\\n'\n }\n } else {\n xml += currentIndent + '<' + key + '>' + escapeXml(value?.toString() || '') + '</' + key + '>\\n'\n }\n\n return xml\n }\n\n let xml = ''\n\n // Add XML declaration if requested\n if (xmlDeclaration) {\n xml += '<?xml version=\"1.0\" encoding=\"UTF-8\"?>'\n if (format) {\n xml += '\\n'\n }\n }\n\n // Convert data to XML\n for (const key in data) {\n if (Object.hasOwn(data, key)) {\n xml += toXml(data[key], key, '')\n }\n }\n\n // Format or compact the output\n if (format) {\n return xml.trim()\n }\n\n // Remove all newlines and extra spaces, but keep the XML declaration clean\n return xml.replace(/\\n/g, '').replace(/>\\s+</g, '><').trim()\n}\n"],
|
|
5
|
-
"mappings": "AAGA,MAAM,iBAAyC;AAAA,EAC7C,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AACP;AAKA,SAAS,UAAU,KAAqB;AACtC,SAAO,IAAI,QAAQ,YAAY,CAAC,SAAS,eAAe,IAAI,KAAK,IAAI;AACvE;AAMO,SAAS,SACd,MACA,UAII,CAAC,GACL;AACA,QAAM,EAAE,SAAS,MAAM,SAAS,MAAM,iBAAiB,KAAK,IAAI;AAEhE,QAAM,QAAQ,CAAC,OAAY,KAAa,kBAAkC;AACxE,QAAIA,OAAM;AAEV,QAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,eAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,IAAI,GAAG,KAAK;AAC5C,QAAAA,QAAO,MAAM,MAAM,CAAC,GAAG,KAAK,aAAa;AAAA,MAC3C;AAAA,IACF,WAAW,OAAO,UAAU,YAAY,UAAU,MAAM;AACtD,UAAI,WAAW;AACf,UAAI,aAAa;AACjB,UAAI,WAAW;AAGf,iBAAW,QAAQ,OAAO;AACxB,YAAI,KAAK,OAAO,CAAC,MAAM,KAAK;AAC1B,wBAAc,MAAM,KAAK,OAAO,CAAC,IAAI,OAAO,UAAU,MAAM,IAAI,EAAE,SAAS,CAAC,IAAI;AAAA,QAClF;AAAA,MACF;AAGA,iBAAW,SAAS,OAAO;AACzB,YAAI,UAAU,SAAS;AACrB,sBAAY,UAAU,MAAM,KAAK,GAAG,SAAS,KAAK,EAAE;AAAA,QACtD,WAAW,UAAU,UAAU;AAE7B,gBAAM,eAAe,MAAM,KAAK,GAAG,SAAS,KAAK;AACjD,sBAAY,cAAc,aAAa,QAAQ,QAAQ,iBAAiB,IAAI;AAAA,QAC9E,WAAW,MAAM,OAAO,CAAC,MAAM,KAAK;AAClC,qBAAW;AACX,sBAAY,MAAM,MAAM,KAAK,GAAG,OAAO,gBAAgB,MAAM;AAAA,QAC/D;AAAA,MACF;AAEA,UAAI,YAAY,UAAU;AACxB,QAAAA,QAAO,gBAAgB,MAAM,MAAM,aAAa;AAChD,QAAAA,QAAO;AACP,QAAAA,QAAO,gBAAgB,OAAO,MAAM;AAAA,MACtC,OAAO;AACL,QAAAA,QAAO,gBAAgB,MAAM,MAAM,aAAa;AAAA,MAClD;AAAA,IACF,OAAO;AACL,MAAAA,QAAO,gBAAgB,MAAM,MAAM,MAAM,UAAU,OAAO,SAAS,KAAK,EAAE,IAAI,OAAO,MAAM;AAAA,IAC7F;AAEA,WAAOA;AAAA,EACT;AAEA,MAAI,MAAM;AAGV,MAAI,gBAAgB;AAClB,WAAO;AACP,QAAI,QAAQ;AACV,aAAO;AAAA,IACT;AAAA,EACF;AAGA,aAAW,OAAO,MAAM;AACtB,QAAI,OAAO,OAAO,MAAM,GAAG,GAAG;AAC5B,aAAO,MAAM,KAAK,GAAG,GAAG,KAAK,EAAE;AAAA,IACjC;AAAA,EACF;AAGA,MAAI,QAAQ;AACV,WAAO,IAAI,KAAK;AAAA,EAClB;AAGA,SAAO,IAAI,QAAQ,OAAO,EAAE,EAAE,QAAQ,UAAU,IAAI,EAAE,KAAK;AAC7D;",
|
|
6
|
-
"names": ["xml"]
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/general/create-limiter.ts"],
|
|
4
|
-
"sourcesContent": ["import { Queue } from '../queue/queue'\n\n/**\n * Creates a function that limits the number of concurrent executions of async functions.\n *\n * @param maxConcurrent - Maximum number of concurrent executions allowed\n * @returns A function that wraps async functions to limit their concurrent execution\n *\n * @example\n * ```ts\n * const limiter = createLimiter(2) // Allow max 2 concurrent executions\n *\n * // These will run with max 2 at a time\n * const results = await Promise.all([\n * limiter(() => fetch('/api/1')),\n * limiter(() => fetch('/api/2')),\n * limiter(() => fetch('/api/3')),\n * limiter(() => fetch('/api/4'))\n * ])\n * ```\n */\nexport function createLimiter(maxConcurrent: number) {\n let activeCount = 0\n const queue = new Queue<() => void>()\n\n const next = () => {\n if (queue.isEmpty() || activeCount >= maxConcurrent) {\n return\n }\n\n const resolve = queue.dequeue()\n\n if (resolve) {\n resolve()\n }\n }\n\n const run = async <T>(fn: () => Promise<T>): Promise<T> => {\n if (activeCount >= maxConcurrent) {\n await new Promise<void>((resolve) => queue.enqueue(resolve))\n }\n\n activeCount++\n try {\n const result = await fn()\n return result\n } finally {\n activeCount--\n next()\n }\n }\n\n return run\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,aAAa;AAqBf,SAAS,cAAc,eAAuB;AACnD,MAAI,cAAc;AAClB,QAAM,QAAQ,IAAI,MAAkB;AAEpC,QAAM,OAAO,MAAM;AACjB,QAAI,MAAM,QAAQ,KAAK,eAAe,eAAe;AACnD;AAAA,IACF;AAEA,UAAM,UAAU,MAAM,QAAQ;AAE9B,QAAI,SAAS;AACX,cAAQ;AAAA,IACV;AAAA,EACF;AAEA,QAAM,MAAM,OAAU,OAAqC;AACzD,QAAI,eAAe,eAAe;AAChC,YAAM,IAAI,QAAc,CAAC,YAAY,MAAM,QAAQ,OAAO,CAAC;AAAA,IAC7D;AAEA;AACA,QAAI;AACF,YAAM,SAAS,MAAM,GAAG;AACxB,aAAO;AAAA,IACT,UAAE;AACA;AACA,WAAK;AAAA,IACP;AAAA,EACF;AAEA,SAAO;AACT;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/general/debounce.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Options for configuring the debounce behavior.\n */\nexport type DebounceOptions = {\n /** The delay in milliseconds before executing the function. Defaults to 100ms. */\n delay?: number\n /** Maximum time in milliseconds to wait before forcing execution, even with continuous calls. */\n maxWait?: number\n}\n\n/**\n * Creates a debounced function executor that delays execution until after a specified time.\n * Multiple calls with the same key will cancel previous pending executions.\n *\n * This is useful for batching rapid updates (like auto-save or API calls) to avoid\n * unnecessary processing or network requests.\n *\n * @param options - Configuration options for delay, maxWait, and key separator\n * @returns A function that accepts a key array and callback to execute\n *\n * @example\n * const debouncedSave = debounce({ delay: 328 })\n * debouncedSave.execute(['user', '123'], () => saveUser(user))\n *\n * @example\n * // With maxWait to guarantee execution even with continuous calls\n * const debouncedSave = debounce({ delay: 328, maxWait: 2000 })\n * debouncedSave.execute(['user', '123'], () => saveUser(user))\n */\nexport const debounce = (options: DebounceOptions = {}) => {\n const { delay = 328, maxWait } = options\n const timeouts = new Map<string, ReturnType<typeof setTimeout>>()\n const maxWaitTimeouts = new Map<string, ReturnType<typeof setTimeout>>()\n const latestFunctions = new Map<string, () => unknown | Promise<unknown>>()\n\n const cleanup = (): void => {\n timeouts.forEach(clearTimeout)\n maxWaitTimeouts.forEach(clearTimeout)\n timeouts.clear()\n maxWaitTimeouts.clear()\n latestFunctions.clear()\n }\n\n /** Executes the function and cleans up all associated timeouts */\n const executeAndCleanup = (key: string): void => {\n // Get the latest function for this key\n const fn = latestFunctions.get(key)\n\n // Clear both timeout types\n const timeout = timeouts.get(key)\n if (timeout !== undefined) {\n clearTimeout(timeout)\n timeouts.delete(key)\n }\n\n const maxWaitTimeout = maxWaitTimeouts.get(key)\n if (maxWaitTimeout !== undefined) {\n clearTimeout(maxWaitTimeout)\n maxWaitTimeouts.delete(key)\n }\n\n // Clear the latest function reference\n latestFunctions.delete(key)\n\n // Execute the function if it exists\n if (fn !== undefined) {\n try {\n fn()\n } catch {\n // Errors are silently caught to prevent the debounce mechanism from breaking\n }\n }\n }\n\n const execute = (key: string, fn: () => unknown | Promise<unknown>): void => {\n // Store the latest function for this key\n latestFunctions.set(key, fn)\n\n // Clear existing debounce timeout\n const existingTimeout = timeouts.get(key)\n if (existingTimeout !== undefined) {\n clearTimeout(existingTimeout)\n }\n\n // Set debounce timeout\n timeouts.set(\n key,\n setTimeout(() => executeAndCleanup(key), delay),\n )\n\n // Set maxWait timeout only if configured and this is a new sequence\n if (maxWait !== undefined && !maxWaitTimeouts.has(key)) {\n maxWaitTimeouts.set(\n key,\n setTimeout(() => executeAndCleanup(key), maxWait),\n )\n }\n }\n\n const flush = (key: string): void => {\n if (!latestFunctions.has(key)) {\n return\n }\n\n executeAndCleanup(key)\n }\n\n const flushAll = (): void => {\n const keys = [...latestFunctions.keys()]\n for (const key of keys) {\n executeAndCleanup(key)\n }\n }\n\n return { execute, cleanup, flush, flushAll }\n}\n"],
|
|
5
|
-
"mappings": "AA6BO,MAAM,WAAW,CAAC,UAA2B,CAAC,MAAM;AACzD,QAAM,EAAE,QAAQ,KAAK,QAAQ,IAAI;AACjC,QAAM,WAAW,oBAAI,IAA2C;AAChE,QAAM,kBAAkB,oBAAI,IAA2C;AACvE,QAAM,kBAAkB,oBAAI,IAA8C;AAE1E,QAAM,UAAU,MAAY;AAC1B,aAAS,QAAQ,YAAY;AAC7B,oBAAgB,QAAQ,YAAY;AACpC,aAAS,MAAM;AACf,oBAAgB,MAAM;AACtB,oBAAgB,MAAM;AAAA,EACxB;AAGA,QAAM,oBAAoB,CAAC,QAAsB;AAE/C,UAAM,KAAK,gBAAgB,IAAI,GAAG;AAGlC,UAAM,UAAU,SAAS,IAAI,GAAG;AAChC,QAAI,YAAY,QAAW;AACzB,mBAAa,OAAO;AACpB,eAAS,OAAO,GAAG;AAAA,IACrB;AAEA,UAAM,iBAAiB,gBAAgB,IAAI,GAAG;AAC9C,QAAI,mBAAmB,QAAW;AAChC,mBAAa,cAAc;AAC3B,sBAAgB,OAAO,GAAG;AAAA,IAC5B;AAGA,oBAAgB,OAAO,GAAG;AAG1B,QAAI,OAAO,QAAW;AACpB,UAAI;AACF,WAAG;AAAA,MACL,QAAQ;AAAA,MAER;AAAA,IACF;AAAA,EACF;AAEA,QAAM,UAAU,CAAC,KAAa,OAA+C;AAE3E,oBAAgB,IAAI,KAAK,EAAE;AAG3B,UAAM,kBAAkB,SAAS,IAAI,GAAG;AACxC,QAAI,oBAAoB,QAAW;AACjC,mBAAa,eAAe;AAAA,IAC9B;AAGA,aAAS;AAAA,MACP;AAAA,MACA,WAAW,MAAM,kBAAkB,GAAG,GAAG,KAAK;AAAA,IAChD;AAGA,QAAI,YAAY,UAAa,CAAC,gBAAgB,IAAI,GAAG,GAAG;AACtD,sBAAgB;AAAA,QACd;AAAA,QACA,WAAW,MAAM,kBAAkB,GAAG,GAAG,OAAO;AAAA,MAClD;AAAA,IACF;AAAA,EACF;AAEA,QAAM,QAAQ,CAAC,QAAsB;AACnC,QAAI,CAAC,gBAAgB,IAAI,GAAG,GAAG;AAC7B;AAAA,IACF;AAEA,sBAAkB,GAAG;AAAA,EACvB;AAEA,QAAM,WAAW,MAAY;AAC3B,UAAM,OAAO,CAAC,GAAG,gBAAgB,KAAK,CAAC;AACvC,eAAW,OAAO,MAAM;AACtB,wBAAkB,GAAG;AAAA,IACvB;AAAA,EACF;AAEA,SAAO,EAAE,SAAS,SAAS,OAAO,SAAS;AAC7C;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/general/extract-config-secrets.ts"],
|
|
4
|
-
"sourcesContent": ["import { objectEntries } from '../object/object-entries'\n\n/**\n * Mapping of field names to their corresponding x-scalar-secret extension names.\n */\nconst SECRET_FIELD_MAPPINGS = {\n clientSecret: 'x-scalar-secret-client-secret',\n password: 'x-scalar-secret-password',\n token: 'x-scalar-secret-token',\n username: 'x-scalar-secret-username',\n value: 'x-scalar-secret-token',\n 'x-scalar-client-id': 'x-scalar-secret-client-id',\n 'x-scalar-redirect-uri': 'x-scalar-secret-redirect-uri',\n} as const\n\n/**\n * Extracts secret fields from the config or the old schemes\n * Maps original field names to their x-scalar-secret extension equivalents.\n */\nexport const extractConfigSecrets = (input: Record<string, unknown>): Record<string, string> =>\n objectEntries(SECRET_FIELD_MAPPINGS).reduce<Record<string, string>>((result, [field, secretField]) => {\n const value = input[field]\n if (value && typeof value === 'string') {\n result[secretField] = value\n }\n return result\n }, {})\n\n/** Set of all secret fields */\nconst SECRETS_SET = new Set<string>(\n objectEntries(SECRET_FIELD_MAPPINGS).flatMap(([oldSecret, newSecret]) => [oldSecret, newSecret]),\n)\n\n/** Removes all secret fields from the input object */\nexport const removeSecretFields = (input: Record<string, unknown>): Record<string, unknown> =>\n objectEntries(input).reduce<Record<string, unknown>>((result, [key, value]) => {\n if (!SECRETS_SET.has(key)) {\n result[key] = value\n }\n return result\n }, {})\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,qBAAqB;AAK9B,MAAM,wBAAwB;AAAA,EAC5B,cAAc;AAAA,EACd,UAAU;AAAA,EACV,OAAO;AAAA,EACP,UAAU;AAAA,EACV,OAAO;AAAA,EACP,sBAAsB;AAAA,EACtB,yBAAyB;AAC3B;AAMO,MAAM,uBAAuB,CAAC,UACnC,cAAc,qBAAqB,EAAE,OAA+B,CAAC,QAAQ,CAAC,OAAO,WAAW,MAAM;AACpG,QAAM,QAAQ,MAAM,KAAK;AACzB,MAAI,SAAS,OAAO,UAAU,UAAU;AACtC,WAAO,WAAW,IAAI;AAAA,EACxB;AACA,SAAO;AACT,GAAG,CAAC,CAAC;AAGP,MAAM,cAAc,IAAI;AAAA,EACtB,cAAc,qBAAqB,EAAE,QAAQ,CAAC,CAAC,WAAW,SAAS,MAAM,CAAC,WAAW,SAAS,CAAC;AACjG;AAGO,MAAM,qBAAqB,CAAC,UACjC,cAAc,KAAK,EAAE,OAAgC,CAAC,QAAQ,CAAC,KAAK,KAAK,MAAM;AAC7E,MAAI,CAAC,YAAY,IAAI,GAAG,GAAG;AACzB,WAAO,GAAG,IAAI;AAAA,EAChB;AACA,SAAO;AACT,GAAG,CAAC,CAAC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/general/has-modifier.ts"],
|
|
4
|
-
"sourcesContent": ["import { isMacOS } from './is-mac-os'\n\n/**\n * Checks for the modifier key\n *\n * Which is meta on macOs and ctrl on linux/windows\n */\nexport const hasModifier = (keydown: KeyboardEvent) => {\n const modifier = isMacOS() ? 'metaKey' : 'ctrlKey'\n return keydown[modifier]\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAAS,eAAe;AAOjB,MAAM,cAAc,CAAC,YAA2B;AACrD,QAAM,WAAW,QAAQ,IAAI,YAAY;AACzC,SAAO,QAAQ,QAAQ;AACzB;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/general/is-mac-os.ts"],
|
|
4
|
-
"sourcesContent": ["/**\n * Checks whether the user is on macOS\n * Uses the modern navigator.userAgentData API with a fallback to navigator.userAgent\n */\nconst getUserAgentDataPlatform = (nav: Navigator): string | undefined => {\n const userAgentData: unknown = Reflect.get(nav, 'userAgentData')\n\n if (!userAgentData || typeof userAgentData !== 'object') {\n return undefined\n }\n\n if (!('platform' in userAgentData) || typeof userAgentData.platform !== 'string') {\n return undefined\n }\n\n return userAgentData.platform\n}\n\nexport const isMacOS = () => {\n if (typeof navigator === 'undefined') {\n return false\n }\n\n // Modern approach using navigator.userAgentData\n const userAgentDataPlatform = getUserAgentDataPlatform(navigator)\n if (userAgentDataPlatform) {\n return userAgentDataPlatform.toLowerCase().includes('mac')\n }\n\n // Fallback to userAgent\n return /Mac/.test(navigator.userAgent)\n}\n"],
|
|
5
|
-
"mappings": "AAIA,MAAM,2BAA2B,CAAC,QAAuC;AACvE,QAAM,gBAAyB,QAAQ,IAAI,KAAK,eAAe;AAE/D,MAAI,CAAC,iBAAiB,OAAO,kBAAkB,UAAU;AACvD,WAAO;AAAA,EACT;AAEA,MAAI,EAAE,cAAc,kBAAkB,OAAO,cAAc,aAAa,UAAU;AAChF,WAAO;AAAA,EACT;AAEA,SAAO,cAAc;AACvB;AAEO,MAAM,UAAU,MAAM;AAC3B,MAAI,OAAO,cAAc,aAAa;AACpC,WAAO;AAAA,EACT;AAGA,QAAM,wBAAwB,yBAAyB,SAAS;AAChE,MAAI,uBAAuB;AACzB,WAAO,sBAAsB,YAAY,EAAE,SAAS,KAAK;AAAA,EAC3D;AAGA,SAAO,MAAM,KAAK,UAAU,SAAS;AACvC;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/http/can-method-have-body.ts"],
|
|
4
|
-
"sourcesContent": ["import type { HttpMethod } from './http-methods'\n\n/** HTTP Methods which can have a body */\nconst BODY_METHODS = ['post', 'put', 'patch', 'delete'] as const satisfies HttpMethod[]\ntype BodyMethod = (typeof BODY_METHODS)[number]\n\n/** Makes a check to see if this method CAN have a body */\nexport const canMethodHaveBody = (method: HttpMethod): method is BodyMethod =>\n BODY_METHODS.includes(method.toLowerCase() as BodyMethod)\n"],
|
|
5
|
-
"mappings": "AAGA,MAAM,eAAe,CAAC,QAAQ,OAAO,SAAS,QAAQ;AAI/C,MAAM,oBAAoB,CAAC,WAChC,aAAa,SAAS,OAAO,YAAY,CAAe;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/http/http-info.ts"],
|
|
4
|
-
"sourcesContent": ["import type { HttpMethod } from './http-methods'\n\nexport type HttpInfo = {\n short: string\n colorClass: `text-${string}`\n colorVar: `var(--scalar-color-${string})`\n backgroundColor: string\n}\n\n/**\n * HTTP methods in a specific order\n * Do not change the order\n */\nexport const REQUEST_METHODS = {\n get: {\n short: 'GET',\n colorClass: 'text-blue',\n colorVar: 'var(--scalar-color-blue)',\n backgroundColor: 'bg-blue/10',\n },\n post: {\n short: 'POST',\n colorClass: 'text-green',\n colorVar: 'var(--scalar-color-green)',\n backgroundColor: 'bg-green/10',\n },\n put: {\n short: 'PUT',\n colorClass: 'text-orange',\n colorVar: 'var(--scalar-color-orange)',\n backgroundColor: 'bg-orange/10',\n },\n patch: {\n short: 'PATCH',\n colorClass: 'text-yellow',\n colorVar: 'var(--scalar-color-yellow)',\n backgroundColor: 'bg-yellow/10',\n },\n delete: {\n short: 'DEL',\n colorClass: 'text-red',\n colorVar: 'var(--scalar-color-red)',\n backgroundColor: 'bg-red/10',\n },\n options: {\n short: 'OPTS',\n colorClass: 'text-purple',\n colorVar: 'var(--scalar-color-purple)',\n backgroundColor: 'bg-purple/10',\n },\n head: {\n short: 'HEAD',\n colorClass: 'text-c-2',\n colorVar: 'var(--scalar-color-2)',\n backgroundColor: 'bg-c-2/10',\n },\n trace: {\n short: 'TRACE',\n colorClass: 'text-c-2',\n colorVar: 'var(--scalar-color-2)',\n backgroundColor: 'bg-c-2/10',\n },\n} as const satisfies Record<HttpMethod, HttpInfo>\n\n/**\n * Accepts an HTTP Method name and returns some properties for the tag\n */\nexport const getHttpMethodInfo = (methodName: string) => {\n const normalizedMethod = methodName.trim().toLowerCase() as HttpMethod\n return (\n REQUEST_METHODS[normalizedMethod] ?? {\n short: normalizedMethod,\n color: 'text-c-2',\n backgroundColor: 'bg-c-2',\n }\n )\n}\n"],
|
|
5
|
-
"mappings": "AAaO,MAAM,kBAAkB;AAAA,EAC7B,KAAK;AAAA,IACH,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,iBAAiB;AAAA,EACnB;AAAA,EACA,MAAM;AAAA,IACJ,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,iBAAiB;AAAA,EACnB;AAAA,EACA,KAAK;AAAA,IACH,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,iBAAiB;AAAA,EACnB;AAAA,EACA,OAAO;AAAA,IACL,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,iBAAiB;AAAA,EACnB;AAAA,EACA,QAAQ;AAAA,IACN,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,iBAAiB;AAAA,EACnB;AAAA,EACA,SAAS;AAAA,IACP,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,iBAAiB;AAAA,EACnB;AAAA,EACA,MAAM;AAAA,IACJ,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,iBAAiB;AAAA,EACnB;AAAA,EACA,OAAO;AAAA,IACL,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,iBAAiB;AAAA,EACnB;AACF;AAKO,MAAM,oBAAoB,CAAC,eAAuB;AACvD,QAAM,mBAAmB,WAAW,KAAK,EAAE,YAAY;AACvD,SACE,gBAAgB,gBAAgB,KAAK;AAAA,IACnC,OAAO;AAAA,IACP,OAAO;AAAA,IACP,iBAAiB;AAAA,EACnB;AAEJ;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/http/http-methods.ts"],
|
|
4
|
-
"sourcesContent": ["/** All OpenAPI HTTP methods */\nexport const HTTP_METHODS = ['delete', 'get', 'head', 'options', 'patch', 'post', 'put', 'trace'] as const\n\n/** All http methods we support */\nexport type HttpMethod = (typeof HTTP_METHODS)[number]\n\n/** Set of all http methods we support */\nexport const httpMethods = Object.freeze(new Set(HTTP_METHODS))\n"],
|
|
5
|
-
"mappings": "AACO,MAAM,eAAe,CAAC,UAAU,OAAO,QAAQ,WAAW,SAAS,QAAQ,OAAO,OAAO;AAMzF,MAAM,cAAc,OAAO,OAAO,IAAI,IAAI,YAAY,CAAC;",
|
|
6
|
-
"names": []
|
|
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;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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AA,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
|
-
}
|
package/dist/node/path.js.map
DELETED
|
@@ -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,IAAI;AAAA,IACpB;AAAA,EACF;AAEA,SAAO;AACT;AAIA,MAAM,cAAc;AACpB,MAAM,YAAY,CAAC,aAAgD,YAAY,KAAK,QAAQ,EAAG,MAAM,CAAC;AAI/F,SAAS,WAAW,YAA2B;AACpD,MAAI,eAAe,IACjB,mBAAmB;AAErB,WAAS,IAAI,WAAW,SAAS,GAAG,KAAK,MAAM,CAAC,kBAAkB,KAAK;AACrE,UAAMA,QAAO,KAAK,IAAI,WAAW,CAAC,IAAI;AAGtC,QAAI,OAAO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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,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KAAK,OAAO,QAAQ,IAAI,GAAG;AAC/C,YAAM,YAAY,GAAG,IAAI,IAAI,kBAAkB,GAAG,CAAC;AAEnD,UAAI,OAAO,UAAU,YAAY,UAAU,MAAM;AAC/C,YAAI,GAAG,IAAI;AACX;AAAA,MACF;AAEA,YAAM,eAAe,MAAM,IAAI,KAAe;AAC9C,UAAI,iBAAiB,QAAW;AAC9B,YAAI,GAAG,IAAI,MAAM,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
|
-
}
|
package/dist/queue/queue.js.map
DELETED
|
@@ -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,YAAY,MAAM;AACxB,QAAM,QAAQ,MAAM;AAEpB,QAAM,KAAK;AACX,QAAM,KAAK;AACX,QAAM,KAAK;AACX,QAAM,KAAK;AAGX,WAAS,IAAI,GAAG,IAAI,OAAO,KAAK,IAAI;AAClC,QAAI,KACD,MAAM,WAAW,CAAC,IAAI,OACrB,MAAM,WAAW,IAAI,CAAC,IAAI,QAAS,KACnC,MAAM,WAAW,IAAI,CAAC,IAAI,QAAS,MACnC,MAAM,WAAW,IAAI,CAAC,IAAI,QAAS;AAEvC,QAAI,KACD,MAAM,WAAW,IAAI,CAAC,IAAI,OACzB,MAAM,WAAW,IAAI,CAAC,IAAI,QAA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B,WAAM,MAAM,KAAO,OAAO;AAC1B,WAAK,KAAK,KAAK,IAAI,EAAE;AACrB,YAAM;AAAA,IACR;AAEA,QAAI,aAAa,GAAG;AAClB,aAAO,MAAM,WAAW,QAAQ,CAAC,IAAI,QAAS;AAAA,IAChD;AACA,QAAI,aAAa,GAAG;AAClB,aAAO,MAAM,WAAW,QAAQ,CAAC,IAAI,QAAS;AAAA,IAChD;AACA,QAAI,aAAa,GAAG;AAClB,aAAO,MAAM,WAAW,QAAQ,CAAC,IAAI,QAAS;AAAA,IAChD;AACA,QAAI,aAAa,GAAG;AAClB,YAAM,MAAM,WAAW,KAAK,IAAI;AAChC,WAAK,KAAK,KAAK,IAAI,EAAE;AACrB,WAAM,MAAM,KAAO,OAAO;AAC1B,WAAK,KAAK,KAAK,IAAI,EAAE;AACrB,YAAM;AAAA,IACR;AAAA,EACF;AAGA,QAAM;AACN,QAAM;AAEN,QAAM;AACN,QAAM;AAEN,QAAM,OAAO;AACb,OAAK,KAAK,KAAK,IAAI,UAAU;AAC7B,QAAM,OAAO;AACb,OAAK,KAAK,KAAK,IAAI,UAAU;AAC7B,QAAM,OAAO;AAEb,QAAM,OAAO;AACb,OAAK,KAAK,KAAK,IAAI,UAAU;AAC7B,QAAM,OAAO;AACb,OAAK,KAAK,KAAK,IAAI,UAAU;AAC7B,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
|
-
}
|