@scalar/helpers 0.0.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.
- package/CHANGELOG.md +7 -0
- package/LICENSE +21 -0
- package/dist/array/is-defined.d.ts +13 -0
- package/dist/array/is-defined.d.ts.map +1 -0
- package/dist/array/is-defined.js +5 -0
- package/dist/array/is-defined.js.map +7 -0
- package/dist/dom/freeze-element.d.ts +11 -0
- package/dist/dom/freeze-element.d.ts.map +1 -0
- package/dist/dom/freeze-element.js +45 -0
- package/dist/dom/freeze-element.js.map +7 -0
- package/dist/dom/scroll-to-id.d.ts +7 -0
- package/dist/dom/scroll-to-id.d.ts.map +1 -0
- package/dist/dom/scroll-to-id.js +29 -0
- package/dist/dom/scroll-to-id.js.map +7 -0
- package/dist/file/json2xml.d.ts +5 -0
- package/dist/file/json2xml.d.ts.map +1 -0
- package/dist/file/json2xml.js +47 -0
- package/dist/file/json2xml.js.map +7 -0
- package/dist/general/is-mac-os.d.ts +6 -0
- package/dist/general/is-mac-os.d.ts.map +1 -0
- package/dist/general/is-mac-os.js +13 -0
- package/dist/general/is-mac-os.js.map +7 -0
- package/dist/http/can-method-have-body.d.ts +8 -0
- package/dist/http/can-method-have-body.d.ts.map +1 -0
- package/dist/http/can-method-have-body.js +6 -0
- package/dist/http/can-method-have-body.js.map +7 -0
- package/dist/http/http-info.d.ts +116 -0
- package/dist/http/http-info.d.ts.map +1 -0
- package/dist/http/http-info.js +69 -0
- package/dist/http/http-info.js.map +7 -0
- package/dist/http/http-methods.d.ts +7 -0
- package/dist/http/http-methods.d.ts.map +1 -0
- package/dist/http/http-methods.js +7 -0
- package/dist/http/http-methods.js.map +7 -0
- package/dist/http/http-status-codes.d.ts +8 -0
- package/dist/http/http-status-codes.d.ts.map +1 -0
- package/dist/http/http-status-codes.js +321 -0
- package/dist/http/http-status-codes.js.map +7 -0
- package/dist/http/is-http-method.d.ts +4 -0
- package/dist/http/is-http-method.d.ts.map +1 -0
- package/dist/http/is-http-method.js +6 -0
- package/dist/http/is-http-method.js.map +7 -0
- package/dist/http/normalize-http-method.d.ts +7 -0
- package/dist/http/normalize-http-method.d.ts.map +1 -0
- package/dist/http/normalize-http-method.js +20 -0
- package/dist/http/normalize-http-method.js.map +7 -0
- package/dist/object/local-storage.d.ts +37 -0
- package/dist/object/local-storage.d.ts.map +1 -0
- package/dist/object/local-storage.js +30 -0
- package/dist/object/local-storage.js.map +7 -0
- package/dist/object/object-keys.d.ts +6 -0
- package/dist/object/object-keys.d.ts.map +1 -0
- package/dist/object/object-keys.js +5 -0
- package/dist/object/object-keys.js.map +7 -0
- package/dist/object/object-replace.d.ts +5 -0
- package/dist/object/object-replace.d.ts.map +1 -0
- package/dist/object/object-replace.js +13 -0
- package/dist/object/object-replace.js.map +7 -0
- package/dist/object/omit-undefined-values.d.ts +7 -0
- package/dist/object/omit-undefined-values.d.ts.map +1 -0
- package/dist/object/omit-undefined-values.js +19 -0
- package/dist/object/omit-undefined-values.js.map +7 -0
- package/dist/regex/find-variables.d.ts +5 -0
- package/dist/regex/find-variables.d.ts.map +1 -0
- package/dist/regex/find-variables.js +6 -0
- package/dist/regex/find-variables.js.map +7 -0
- package/dist/regex/regex-helpers.d.ts +10 -0
- package/dist/regex/regex-helpers.d.ts.map +1 -0
- package/dist/regex/regex-helpers.js +13 -0
- package/dist/regex/regex-helpers.js.map +7 -0
- package/dist/regex/replace-variables.d.ts +5 -0
- package/dist/regex/replace-variables.d.ts.map +1 -0
- package/dist/regex/replace-variables.js +15 -0
- package/dist/regex/replace-variables.js.map +7 -0
- package/dist/string/camel-to-title.d.ts +7 -0
- package/dist/string/camel-to-title.d.ts.map +1 -0
- package/dist/string/camel-to-title.js +5 -0
- package/dist/string/camel-to-title.js.map +7 -0
- package/dist/string/capitalize.d.ts +6 -0
- package/dist/string/capitalize.d.ts.map +1 -0
- package/dist/string/capitalize.js +5 -0
- package/dist/string/capitalize.js.map +7 -0
- package/dist/string/create-hash.d.ts +7 -0
- package/dist/string/create-hash.d.ts.map +1 -0
- package/dist/string/create-hash.js +18 -0
- package/dist/string/create-hash.js.map +7 -0
- package/dist/string/iterate-title.d.ts +5 -0
- package/dist/string/iterate-title.d.ts.map +1 -0
- package/dist/string/iterate-title.js +12 -0
- package/dist/string/iterate-title.js.map +7 -0
- package/dist/testing/console-spies.d.ts +17 -0
- package/dist/testing/console-spies.d.ts.map +1 -0
- package/dist/testing/console-spies.js +25 -0
- package/dist/testing/console-spies.js.map +7 -0
- package/dist/testing/measure.d.ts +26 -0
- package/dist/testing/measure.d.ts.map +1 -0
- package/dist/testing/measure.js +12 -0
- package/dist/testing/measure.js.map +7 -0
- package/dist/testing/sleep.d.ts +6 -0
- package/dist/testing/sleep.d.ts.map +1 -0
- package/dist/testing/sleep.js +5 -0
- package/dist/testing/sleep.js.map +7 -0
- package/dist/url/ensure-protocol.d.ts +3 -0
- package/dist/url/ensure-protocol.d.ts.map +1 -0
- package/dist/url/ensure-protocol.js +11 -0
- package/dist/url/ensure-protocol.js.map +7 -0
- package/dist/url/is-local-url.d.ts +5 -0
- package/dist/url/is-local-url.d.ts.map +1 -0
- package/dist/url/is-local-url.js +13 -0
- package/dist/url/is-local-url.js.map +7 -0
- package/dist/url/is-relative-path.d.ts +5 -0
- package/dist/url/is-relative-path.d.ts.map +1 -0
- package/dist/url/is-relative-path.js +14 -0
- package/dist/url/is-relative-path.js.map +7 -0
- package/dist/url/is-valid-url.d.ts +12 -0
- package/dist/url/is-valid-url.d.ts.map +1 -0
- package/dist/url/is-valid-url.js +11 -0
- package/dist/url/is-valid-url.js.map +7 -0
- package/dist/url/make-url-absolute.d.ts +5 -0
- package/dist/url/make-url-absolute.d.ts.map +1 -0
- package/dist/url/make-url-absolute.js +13 -0
- package/dist/url/make-url-absolute.js.map +7 -0
- package/dist/url/merge-urls.d.ts +15 -0
- package/dist/url/merge-urls.d.ts.map +1 -0
- package/dist/url/merge-urls.js +56 -0
- package/dist/url/merge-urls.js.map +7 -0
- package/package.json +95 -0
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023-present Scalar
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type safe alternative to array.filter(Boolean)
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* const dataArray = [1, null, 2, undefined, 3].filter(isDefined)
|
|
8
|
+
* ```
|
|
9
|
+
*
|
|
10
|
+
* @see https://jaketrent.com/post/typescript-type-safe-filter-boolean/
|
|
11
|
+
*/
|
|
12
|
+
export declare const isDefined: <T>(value: T | null | undefined) => value is NonNullable<T>;
|
|
13
|
+
//# sourceMappingURL=is-defined.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-defined.d.ts","sourceRoot":"","sources":["../../src/array/is-defined.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS,GAAI,CAAC,SAAS,CAAC,GAAG,IAAI,GAAG,SAAS,KAAG,KAAK,IAAI,WAAW,CAAC,CAAC,CAC1C,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/array/is-defined.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Type safe alternative to array.filter(Boolean)\n *\n * @example\n *\n * ```ts\n * const dataArray = [1, null, 2, undefined, 3].filter(isDefined)\n * ```\n *\n * @see https://jaketrent.com/post/typescript-type-safe-filter-boolean/\n */\nexport const isDefined = <T>(value: T | null | undefined): value is NonNullable<T> =>\n value !== null && value !== undefined\n"],
|
|
5
|
+
"mappings": "AAWO,MAAM,YAAY,CAAI,UAC3B,UAAU,QAAQ,UAAU;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scroll Freezing Utility
|
|
3
|
+
* "Freezes" the scroll position of an element, so that it doesn't move when the rest of the content changes
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* const unfreeze = freezeElement(document.querySelector('#your-element'))
|
|
7
|
+
* ... content changes ...
|
|
8
|
+
* unfreeze()
|
|
9
|
+
*/
|
|
10
|
+
export declare const freezeElement: (element: HTMLElement) => () => void;
|
|
11
|
+
//# sourceMappingURL=freeze-element.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"freeze-element.d.ts","sourceRoot":"","sources":["../../src/dom/freeze-element.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,YAAa,WAAW,eA4DjD,CAAA"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const freezeElement = (element) => {
|
|
2
|
+
if (!element) {
|
|
3
|
+
return () => null;
|
|
4
|
+
}
|
|
5
|
+
const rect = element.getBoundingClientRect();
|
|
6
|
+
const initialViewportTop = rect.top;
|
|
7
|
+
let rafId = null;
|
|
8
|
+
const observer = new MutationObserver((mutations) => {
|
|
9
|
+
const shouldProcess = mutations.some(
|
|
10
|
+
(mutation) => mutation.type === "childList" || mutation.type === "attributes" && (mutation.attributeName === "style" || mutation.attributeName === "class")
|
|
11
|
+
);
|
|
12
|
+
if (!shouldProcess) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
if (rafId !== null) {
|
|
16
|
+
cancelAnimationFrame(rafId);
|
|
17
|
+
}
|
|
18
|
+
rafId = requestAnimationFrame(() => {
|
|
19
|
+
const newRect = element.getBoundingClientRect();
|
|
20
|
+
const currentViewportTop = newRect.top;
|
|
21
|
+
if (currentViewportTop !== initialViewportTop) {
|
|
22
|
+
const diff = currentViewportTop - initialViewportTop;
|
|
23
|
+
window.scrollBy(0, diff);
|
|
24
|
+
}
|
|
25
|
+
rafId = null;
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
observer.observe(document.body, {
|
|
29
|
+
childList: true,
|
|
30
|
+
subtree: true,
|
|
31
|
+
attributes: true,
|
|
32
|
+
attributeFilter: ["style", "class"],
|
|
33
|
+
characterData: false
|
|
34
|
+
});
|
|
35
|
+
return () => {
|
|
36
|
+
if (rafId !== null) {
|
|
37
|
+
cancelAnimationFrame(rafId);
|
|
38
|
+
}
|
|
39
|
+
observer.disconnect();
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export {
|
|
43
|
+
freezeElement
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=freeze-element.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/freeze-element.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Scroll Freezing Utility\n * \"Freezes\" the scroll position of an element, so that it doesn't move when the rest of the content changes\n *\n * @example\n * const unfreeze = freezeElement(document.querySelector('#your-element'))\n * ... content changes ...\n * unfreeze()\n */\nexport const freezeElement = (element: HTMLElement) => {\n if (!element) {\n return () => null\n }\n\n // Get initial position relative to viewport\n const rect = element.getBoundingClientRect()\n const initialViewportTop = rect.top\n let rafId: number | null = null\n\n // Create mutation observer to watch for DOM changes\n const observer = new MutationObserver((mutations) => {\n // Only process if we have mutations that might affect layout\n const shouldProcess = mutations.some(\n (mutation) =>\n mutation.type === 'childList' ||\n (mutation.type === 'attributes' && (mutation.attributeName === 'style' || mutation.attributeName === 'class')),\n )\n\n if (!shouldProcess) {\n return\n }\n\n // Cancel any pending animation frame\n if (rafId !== null) {\n cancelAnimationFrame(rafId)\n }\n\n // Schedule the scroll adjustment for the next frame\n rafId = requestAnimationFrame(() => {\n const newRect = element.getBoundingClientRect()\n const currentViewportTop = newRect.top\n\n // If element has moved from its initial viewport position\n if (currentViewportTop !== initialViewportTop) {\n // Calculate how far it moved\n const diff = currentViewportTop - initialViewportTop\n // Adjust scroll to maintain position\n window.scrollBy(0, diff)\n }\n rafId = null\n })\n })\n\n // Start observing with more specific configuration\n observer.observe(document.body, {\n childList: true,\n subtree: true,\n attributes: true,\n attributeFilter: ['style', 'class'],\n characterData: false,\n })\n\n // Return function to stop maintaining position\n return () => {\n if (rafId !== null) {\n cancelAnimationFrame(rafId)\n }\n observer.disconnect()\n }\n}\n"],
|
|
5
|
+
"mappings": "AASO,MAAM,gBAAgB,CAAC,YAAyB;AACrD,MAAI,CAAC,SAAS;AACZ,WAAO,MAAM;AAAA,EACf;AAGA,QAAM,OAAO,QAAQ,sBAAsB;AAC3C,QAAM,qBAAqB,KAAK;AAChC,MAAI,QAAuB;AAG3B,QAAM,WAAW,IAAI,iBAAiB,CAAC,cAAc;AAEnD,UAAM,gBAAgB,UAAU;AAAA,MAC9B,CAAC,aACC,SAAS,SAAS,eACjB,SAAS,SAAS,iBAAiB,SAAS,kBAAkB,WAAW,SAAS,kBAAkB;AAAA,IACzG;AAEA,QAAI,CAAC,eAAe;AAClB;AAAA,IACF;AAGA,QAAI,UAAU,MAAM;AAClB,2BAAqB,KAAK;AAAA,IAC5B;AAGA,YAAQ,sBAAsB,MAAM;AAClC,YAAM,UAAU,QAAQ,sBAAsB;AAC9C,YAAM,qBAAqB,QAAQ;AAGnC,UAAI,uBAAuB,oBAAoB;AAE7C,cAAM,OAAO,qBAAqB;AAElC,eAAO,SAAS,GAAG,IAAI;AAAA,MACzB;AACA,cAAQ;AAAA,IACV,CAAC;AAAA,EACH,CAAC;AAGD,WAAS,QAAQ,SAAS,MAAM;AAAA,IAC9B,WAAW;AAAA,IACX,SAAS;AAAA,IACT,YAAY;AAAA,IACZ,iBAAiB,CAAC,SAAS,OAAO;AAAA,IAClC,eAAe;AAAA,EACjB,CAAC;AAGD,SAAO,MAAM;AACX,QAAI,UAAU,MAAM;AAClB,2BAAqB,KAAK;AAAA,IAC5B;AACA,aAAS,WAAW;AAAA,EACtB;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scroll-to-id.d.ts","sourceRoot":"","sources":["../../src/dom/scroll-to-id.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,UAAU,OAAc,MAAM,UAAU,OAAO,kBAkC3D,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const scrollToId = async (id, focus) => {
|
|
2
|
+
const scrollToElement = (element2) => {
|
|
3
|
+
element2.scrollIntoView();
|
|
4
|
+
if (focus) {
|
|
5
|
+
element2.focus();
|
|
6
|
+
}
|
|
7
|
+
};
|
|
8
|
+
const element = document.getElementById(id);
|
|
9
|
+
if (element) {
|
|
10
|
+
scrollToElement(element);
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
const stopTime = Date.now() + 1e3;
|
|
14
|
+
const tryScroll = () => {
|
|
15
|
+
const element2 = document.getElementById(id);
|
|
16
|
+
if (element2) {
|
|
17
|
+
scrollToElement(element2);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (Date.now() < stopTime) {
|
|
21
|
+
requestAnimationFrame(tryScroll);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
requestAnimationFrame(tryScroll);
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
scrollToId
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=scroll-to-id.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/dom/scroll-to-id.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Tiny wrapper around the scrollIntoView API\n *\n * Also focuses the element if the focus flag is true\n */\nexport const scrollToId = async (id: string, focus?: boolean) => {\n const scrollToElement = (element: HTMLElement) => {\n element.scrollIntoView()\n if (focus) {\n element.focus()\n }\n }\n\n // Try to find the element immediately\n const element = document.getElementById(id)\n if (element) {\n scrollToElement(element)\n return\n }\n\n /** Try to find the element for up to 1 second\n * allowing it to render for instance in markdown heading usage\n */\n const stopTime = Date.now() + 1000\n\n const tryScroll = () => {\n const element = document.getElementById(id)\n if (element) {\n scrollToElement(element)\n return\n }\n\n if (Date.now() < stopTime) {\n requestAnimationFrame(tryScroll)\n }\n }\n\n // Start the retry process if the element doesn't exist yet\n requestAnimationFrame(tryScroll)\n}\n"],
|
|
5
|
+
"mappings": "AAKO,MAAM,aAAa,OAAO,IAAY,UAAoB;AAC/D,QAAM,kBAAkB,CAACA,aAAyB;AAChD,IAAAA,SAAQ,eAAe;AACvB,QAAI,OAAO;AACT,MAAAA,SAAQ,MAAM;AAAA,IAChB;AAAA,EACF;AAGA,QAAM,UAAU,SAAS,eAAe,EAAE;AAC1C,MAAI,SAAS;AACX,oBAAgB,OAAO;AACvB;AAAA,EACF;AAKA,QAAM,WAAW,KAAK,IAAI,IAAI;AAE9B,QAAM,YAAY,MAAM;AACtB,UAAMA,WAAU,SAAS,eAAe,EAAE;AAC1C,QAAIA,UAAS;AACX,sBAAgBA,QAAO;AACvB;AAAA,IACF;AAEA,QAAI,KAAK,IAAI,IAAI,UAAU;AACzB,4BAAsB,SAAS;AAAA,IACjC;AAAA,EACF;AAGA,wBAAsB,SAAS;AACjC;",
|
|
6
|
+
"names": ["element"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"json2xml.d.ts","sourceRoot":"","sources":["../../src/file/json2xml.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,UAiD/D"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
function json2xml(data, tab) {
|
|
2
|
+
const toXml = (value, key, indentation) => {
|
|
3
|
+
let xml2 = "";
|
|
4
|
+
if (Array.isArray(value)) {
|
|
5
|
+
for (let i = 0, n = value.length; i < n; i++) {
|
|
6
|
+
xml2 += indentation + toXml(value[i], key, indentation + " ") + "\n";
|
|
7
|
+
}
|
|
8
|
+
} else if (typeof value === "object") {
|
|
9
|
+
let hasChild = false;
|
|
10
|
+
xml2 += indentation + "<" + key;
|
|
11
|
+
for (const m in value) {
|
|
12
|
+
if (m.charAt(0) === "@") {
|
|
13
|
+
xml2 += " " + m.substr(1) + '="' + value[m].toString() + '"';
|
|
14
|
+
} else {
|
|
15
|
+
hasChild = true;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
xml2 += hasChild ? ">" : "/>";
|
|
19
|
+
if (hasChild) {
|
|
20
|
+
for (const m in value) {
|
|
21
|
+
if (m === "#text") {
|
|
22
|
+
xml2 += value[m];
|
|
23
|
+
} else if (m === "#cdata") {
|
|
24
|
+
xml2 += "<![CDATA[" + value[m] + "]]>";
|
|
25
|
+
} else if (m.charAt(0) !== "@") {
|
|
26
|
+
xml2 += toXml(value[m], m, indentation + " ");
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
xml2 += (xml2.charAt(xml2.length - 1) === "\n" ? indentation : "") + "</" + key + ">";
|
|
30
|
+
}
|
|
31
|
+
} else {
|
|
32
|
+
xml2 += indentation + "<" + key + ">" + value.toString() + "</" + key + ">";
|
|
33
|
+
}
|
|
34
|
+
return xml2;
|
|
35
|
+
};
|
|
36
|
+
let xml = "";
|
|
37
|
+
for (const key in data) {
|
|
38
|
+
if (Object.hasOwn(data, key)) {
|
|
39
|
+
xml += toXml(data[key], key, "");
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return tab ? xml.replace(/\t/g, tab) : xml.replace(/\t|\n/g, "");
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
json2xml
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=json2xml.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/file/json2xml.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * This function converts an object to XML.\n */\nexport function json2xml(data: Record<string, any>, tab?: string) {\n const toXml = (value: any, key: string, indentation: string) => {\n let xml = ''\n\n if (Array.isArray(value)) {\n for (let i = 0, n = value.length; i < n; i++) {\n xml += indentation + toXml(value[i], key, indentation + '\\t') + '\\n'\n }\n } else if (typeof value === 'object') {\n let hasChild = false\n xml += indentation + '<' + key\n\n for (const m in value) {\n if (m.charAt(0) === '@') {\n xml += ' ' + m.substr(1) + '=\"' + value[m].toString() + '\"'\n } else {\n hasChild = true\n }\n }\n\n xml += hasChild ? '>' : '/>'\n\n if (hasChild) {\n for (const m in value) {\n if (m === '#text') {\n xml += value[m]\n } else if (m === '#cdata') {\n xml += '<![CDATA[' + value[m] + ']]>'\n } else if (m.charAt(0) !== '@') {\n xml += toXml(value[m], m, indentation + '\\t')\n }\n }\n xml += (xml.charAt(xml.length - 1) === '\\n' ? indentation : '') + '</' + key + '>'\n }\n } else {\n xml += indentation + '<' + key + '>' + value.toString() + '</' + key + '>'\n }\n return xml\n }\n\n let xml = ''\n\n for (const key in data) {\n if (Object.hasOwn(data, key)) {\n xml += toXml(data[key], key, '')\n }\n }\n\n return tab ? xml.replace(/\\t/g, tab) : xml.replace(/\\t|\\n/g, '')\n}\n"],
|
|
5
|
+
"mappings": "AAGO,SAAS,SAAS,MAA2B,KAAc;AAChE,QAAM,QAAQ,CAAC,OAAY,KAAa,gBAAwB;AAC9D,QAAIA,OAAM;AAEV,QAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,eAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,IAAI,GAAG,KAAK;AAC5C,QAAAA,QAAO,cAAc,MAAM,MAAM,CAAC,GAAG,KAAK,cAAc,GAAI,IAAI;AAAA,MAClE;AAAA,IACF,WAAW,OAAO,UAAU,UAAU;AACpC,UAAI,WAAW;AACf,MAAAA,QAAO,cAAc,MAAM;AAE3B,iBAAW,KAAK,OAAO;AACrB,YAAI,EAAE,OAAO,CAAC,MAAM,KAAK;AACvB,UAAAA,QAAO,MAAM,EAAE,OAAO,CAAC,IAAI,OAAO,MAAM,CAAC,EAAE,SAAS,IAAI;AAAA,QAC1D,OAAO;AACL,qBAAW;AAAA,QACb;AAAA,MACF;AAEA,MAAAA,QAAO,WAAW,MAAM;AAExB,UAAI,UAAU;AACZ,mBAAW,KAAK,OAAO;AACrB,cAAI,MAAM,SAAS;AACjB,YAAAA,QAAO,MAAM,CAAC;AAAA,UAChB,WAAW,MAAM,UAAU;AACzB,YAAAA,QAAO,cAAc,MAAM,CAAC,IAAI;AAAA,UAClC,WAAW,EAAE,OAAO,CAAC,MAAM,KAAK;AAC9B,YAAAA,QAAO,MAAM,MAAM,CAAC,GAAG,GAAG,cAAc,GAAI;AAAA,UAC9C;AAAA,QACF;AACA,QAAAA,SAAQA,KAAI,OAAOA,KAAI,SAAS,CAAC,MAAM,OAAO,cAAc,MAAM,OAAO,MAAM;AAAA,MACjF;AAAA,IACF,OAAO;AACL,MAAAA,QAAO,cAAc,MAAM,MAAM,MAAM,MAAM,SAAS,IAAI,OAAO,MAAM;AAAA,IACzE;AACA,WAAOA;AAAA,EACT;AAEA,MAAI,MAAM;AAEV,aAAW,OAAO,MAAM;AACtB,QAAI,OAAO,OAAO,MAAM,GAAG,GAAG;AAC5B,aAAO,MAAM,KAAK,GAAG,GAAG,KAAK,EAAE;AAAA,IACjC;AAAA,EACF;AAEA,SAAO,MAAM,IAAI,QAAQ,OAAO,GAAG,IAAI,IAAI,QAAQ,UAAU,EAAE;AACjE;",
|
|
6
|
+
"names": ["xml"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-mac-os.d.ts","sourceRoot":"","sources":["../../src/general/is-mac-os.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,OAAO,WAcnB,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const isMacOS = () => {
|
|
2
|
+
if (typeof navigator === "undefined") {
|
|
3
|
+
return false;
|
|
4
|
+
}
|
|
5
|
+
if (navigator.userAgentData?.platform) {
|
|
6
|
+
return navigator.userAgentData.platform.toLowerCase().includes("mac");
|
|
7
|
+
}
|
|
8
|
+
return /Mac/.test(navigator.userAgent);
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
isMacOS
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=is-mac-os.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
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 */\nexport const isMacOS = () => {\n if (typeof navigator === 'undefined') {\n return false\n }\n\n // Modern approach using navigator.userAgentData\n // @ts-expect-error - userAgentData is new, we can remove this when its stable\n if (navigator.userAgentData?.platform) {\n // @ts-expect-error - userAgentData is new, we can remove this when its stable\n return navigator.userAgentData.platform.toLowerCase().includes('mac')\n }\n\n // Fallback to userAgent\n return /Mac/.test(navigator.userAgent)\n}\n"],
|
|
5
|
+
"mappings": "AAIO,MAAM,UAAU,MAAM;AAC3B,MAAI,OAAO,cAAc,aAAa;AACpC,WAAO;AAAA,EACT;AAIA,MAAI,UAAU,eAAe,UAAU;AAErC,WAAO,UAAU,cAAc,SAAS,YAAY,EAAE,SAAS,KAAK;AAAA,EACtE;AAGA,SAAO,MAAM,KAAK,UAAU,SAAS;AACvC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { HttpMethod } from './http-methods';
|
|
2
|
+
/** HTTP Methods which can have a body */
|
|
3
|
+
declare const BODY_METHODS: ["post", "put", "patch", "delete"];
|
|
4
|
+
type BodyMethod = (typeof BODY_METHODS)[number];
|
|
5
|
+
/** Makes a check to see if this method CAN have a body */
|
|
6
|
+
export declare const canMethodHaveBody: (method: HttpMethod) => method is BodyMethod;
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=can-method-have-body.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"can-method-have-body.d.ts","sourceRoot":"","sources":["../../src/http/can-method-have-body.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEhD,yCAAyC;AACzC,QAAA,MAAM,YAAY,oCAAqE,CAAA;AACvF,KAAK,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAA;AAE/C,0DAA0D;AAC1D,eAAO,MAAM,iBAAiB,WAAY,UAAU,KAAG,MAAM,IAAI,UACN,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
export type HttpInfo = {
|
|
2
|
+
short: string;
|
|
3
|
+
colorClass: `text-${string}`;
|
|
4
|
+
colorVar: `var(--scalar-color-${string})`;
|
|
5
|
+
backgroundColor: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* HTTP methods in a specific order
|
|
9
|
+
* Do not change the order
|
|
10
|
+
*/
|
|
11
|
+
export declare const REQUEST_METHODS: {
|
|
12
|
+
readonly get: {
|
|
13
|
+
readonly short: "GET";
|
|
14
|
+
readonly colorClass: "text-blue";
|
|
15
|
+
readonly colorVar: "var(--scalar-color-blue)";
|
|
16
|
+
readonly backgroundColor: "bg-blue/10";
|
|
17
|
+
};
|
|
18
|
+
readonly post: {
|
|
19
|
+
readonly short: "POST";
|
|
20
|
+
readonly colorClass: "text-green";
|
|
21
|
+
readonly colorVar: "var(--scalar-color-green)";
|
|
22
|
+
readonly backgroundColor: "bg-green/10";
|
|
23
|
+
};
|
|
24
|
+
readonly put: {
|
|
25
|
+
readonly short: "PUT";
|
|
26
|
+
readonly colorClass: "text-orange";
|
|
27
|
+
readonly colorVar: "var(--scalar-color-orange)";
|
|
28
|
+
readonly backgroundColor: "bg-orange/10";
|
|
29
|
+
};
|
|
30
|
+
readonly patch: {
|
|
31
|
+
readonly short: "PATCH";
|
|
32
|
+
readonly colorClass: "text-yellow";
|
|
33
|
+
readonly colorVar: "var(--scalar-color-yellow)";
|
|
34
|
+
readonly backgroundColor: "bg-yellow/10";
|
|
35
|
+
};
|
|
36
|
+
readonly delete: {
|
|
37
|
+
readonly short: "DEL";
|
|
38
|
+
readonly colorClass: "text-red";
|
|
39
|
+
readonly colorVar: "var(--scalar-color-red)";
|
|
40
|
+
readonly backgroundColor: "bg-red/10";
|
|
41
|
+
};
|
|
42
|
+
readonly options: {
|
|
43
|
+
readonly short: "OPTS";
|
|
44
|
+
readonly colorClass: "text-purple";
|
|
45
|
+
readonly colorVar: "var(--scalar-color-purple)";
|
|
46
|
+
readonly backgroundColor: "bg-purple/10";
|
|
47
|
+
};
|
|
48
|
+
readonly head: {
|
|
49
|
+
readonly short: "HEAD";
|
|
50
|
+
readonly colorClass: "text-c-2";
|
|
51
|
+
readonly colorVar: "var(--scalar-color-2)";
|
|
52
|
+
readonly backgroundColor: "bg-c-2/10";
|
|
53
|
+
};
|
|
54
|
+
readonly connect: {
|
|
55
|
+
readonly short: "CONN";
|
|
56
|
+
readonly colorClass: "text-c-2";
|
|
57
|
+
readonly colorVar: "var(--scalar-color-2)";
|
|
58
|
+
readonly backgroundColor: "bg-c-2/10";
|
|
59
|
+
};
|
|
60
|
+
readonly trace: {
|
|
61
|
+
readonly short: "TRACE";
|
|
62
|
+
readonly colorClass: "text-c-2";
|
|
63
|
+
readonly colorVar: "var(--scalar-color-2)";
|
|
64
|
+
readonly backgroundColor: "bg-c-2/10";
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Accepts an HTTP Method name and returns some properties for the tag
|
|
69
|
+
*/
|
|
70
|
+
export declare const getHttpMethodInfo: (methodName: string) => {
|
|
71
|
+
readonly short: "GET";
|
|
72
|
+
readonly colorClass: "text-blue";
|
|
73
|
+
readonly colorVar: "var(--scalar-color-blue)";
|
|
74
|
+
readonly backgroundColor: "bg-blue/10";
|
|
75
|
+
} | {
|
|
76
|
+
readonly short: "POST";
|
|
77
|
+
readonly colorClass: "text-green";
|
|
78
|
+
readonly colorVar: "var(--scalar-color-green)";
|
|
79
|
+
readonly backgroundColor: "bg-green/10";
|
|
80
|
+
} | {
|
|
81
|
+
readonly short: "PUT";
|
|
82
|
+
readonly colorClass: "text-orange";
|
|
83
|
+
readonly colorVar: "var(--scalar-color-orange)";
|
|
84
|
+
readonly backgroundColor: "bg-orange/10";
|
|
85
|
+
} | {
|
|
86
|
+
readonly short: "PATCH";
|
|
87
|
+
readonly colorClass: "text-yellow";
|
|
88
|
+
readonly colorVar: "var(--scalar-color-yellow)";
|
|
89
|
+
readonly backgroundColor: "bg-yellow/10";
|
|
90
|
+
} | {
|
|
91
|
+
readonly short: "DEL";
|
|
92
|
+
readonly colorClass: "text-red";
|
|
93
|
+
readonly colorVar: "var(--scalar-color-red)";
|
|
94
|
+
readonly backgroundColor: "bg-red/10";
|
|
95
|
+
} | {
|
|
96
|
+
readonly short: "OPTS";
|
|
97
|
+
readonly colorClass: "text-purple";
|
|
98
|
+
readonly colorVar: "var(--scalar-color-purple)";
|
|
99
|
+
readonly backgroundColor: "bg-purple/10";
|
|
100
|
+
} | {
|
|
101
|
+
readonly short: "HEAD";
|
|
102
|
+
readonly colorClass: "text-c-2";
|
|
103
|
+
readonly colorVar: "var(--scalar-color-2)";
|
|
104
|
+
readonly backgroundColor: "bg-c-2/10";
|
|
105
|
+
} | {
|
|
106
|
+
readonly short: "CONN";
|
|
107
|
+
readonly colorClass: "text-c-2";
|
|
108
|
+
readonly colorVar: "var(--scalar-color-2)";
|
|
109
|
+
readonly backgroundColor: "bg-c-2/10";
|
|
110
|
+
} | {
|
|
111
|
+
readonly short: "TRACE";
|
|
112
|
+
readonly colorClass: "text-c-2";
|
|
113
|
+
readonly colorVar: "var(--scalar-color-2)";
|
|
114
|
+
readonly backgroundColor: "bg-c-2/10";
|
|
115
|
+
};
|
|
116
|
+
//# sourceMappingURL=http-info.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-info.d.ts","sourceRoot":"","sources":["../../src/http/http-info.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,QAAQ,MAAM,EAAE,CAAA;IAC5B,QAAQ,EAAE,sBAAsB,MAAM,GAAG,CAAA;IACzC,eAAe,EAAE,MAAM,CAAA;CACxB,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuDqB,CAAA;AAEjD;;GAEG;AACH,eAAO,MAAM,iBAAiB,eAAgB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CASnD,CAAA"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
const REQUEST_METHODS = {
|
|
2
|
+
get: {
|
|
3
|
+
short: "GET",
|
|
4
|
+
colorClass: "text-blue",
|
|
5
|
+
colorVar: "var(--scalar-color-blue)",
|
|
6
|
+
backgroundColor: "bg-blue/10"
|
|
7
|
+
},
|
|
8
|
+
post: {
|
|
9
|
+
short: "POST",
|
|
10
|
+
colorClass: "text-green",
|
|
11
|
+
colorVar: "var(--scalar-color-green)",
|
|
12
|
+
backgroundColor: "bg-green/10"
|
|
13
|
+
},
|
|
14
|
+
put: {
|
|
15
|
+
short: "PUT",
|
|
16
|
+
colorClass: "text-orange",
|
|
17
|
+
colorVar: "var(--scalar-color-orange)",
|
|
18
|
+
backgroundColor: "bg-orange/10"
|
|
19
|
+
},
|
|
20
|
+
patch: {
|
|
21
|
+
short: "PATCH",
|
|
22
|
+
colorClass: "text-yellow",
|
|
23
|
+
colorVar: "var(--scalar-color-yellow)",
|
|
24
|
+
backgroundColor: "bg-yellow/10"
|
|
25
|
+
},
|
|
26
|
+
delete: {
|
|
27
|
+
short: "DEL",
|
|
28
|
+
colorClass: "text-red",
|
|
29
|
+
colorVar: "var(--scalar-color-red)",
|
|
30
|
+
backgroundColor: "bg-red/10"
|
|
31
|
+
},
|
|
32
|
+
options: {
|
|
33
|
+
short: "OPTS",
|
|
34
|
+
colorClass: "text-purple",
|
|
35
|
+
colorVar: "var(--scalar-color-purple)",
|
|
36
|
+
backgroundColor: "bg-purple/10"
|
|
37
|
+
},
|
|
38
|
+
head: {
|
|
39
|
+
short: "HEAD",
|
|
40
|
+
colorClass: "text-c-2",
|
|
41
|
+
colorVar: "var(--scalar-color-2)",
|
|
42
|
+
backgroundColor: "bg-c-2/10"
|
|
43
|
+
},
|
|
44
|
+
connect: {
|
|
45
|
+
short: "CONN",
|
|
46
|
+
colorClass: "text-c-2",
|
|
47
|
+
colorVar: "var(--scalar-color-2)",
|
|
48
|
+
backgroundColor: "bg-c-2/10"
|
|
49
|
+
},
|
|
50
|
+
trace: {
|
|
51
|
+
short: "TRACE",
|
|
52
|
+
colorClass: "text-c-2",
|
|
53
|
+
colorVar: "var(--scalar-color-2)",
|
|
54
|
+
backgroundColor: "bg-c-2/10"
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const getHttpMethodInfo = (methodName) => {
|
|
58
|
+
const normalizedMethod = methodName.trim().toLowerCase();
|
|
59
|
+
return REQUEST_METHODS[normalizedMethod] ?? {
|
|
60
|
+
short: normalizedMethod,
|
|
61
|
+
color: "text-c-2",
|
|
62
|
+
backgroundColor: "bg-c-2"
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
export {
|
|
66
|
+
REQUEST_METHODS,
|
|
67
|
+
getHttpMethodInfo
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=http-info.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
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 connect: {\n short: 'CONN',\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,SAAS;AAAA,IACP,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
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** All OpenAPI HTTP methods plus connect */
|
|
2
|
+
export declare const HTTP_METHODS: readonly ["connect", "delete", "get", "head", "options", "patch", "post", "put", "trace"];
|
|
3
|
+
/** All http methods we support */
|
|
4
|
+
export type HttpMethod = (typeof HTTP_METHODS)[number];
|
|
5
|
+
/** Set of all http methods we support */
|
|
6
|
+
export declare const httpMethods: Set<"connect" | "delete" | "get" | "head" | "options" | "patch" | "post" | "put" | "trace">;
|
|
7
|
+
//# sourceMappingURL=http-methods.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-methods.d.ts","sourceRoot":"","sources":["../../src/http/http-methods.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,eAAO,MAAM,YAAY,2FAA4F,CAAA;AAErH,kCAAkC;AAClC,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAA;AAEtD,yCAAyC;AACzC,eAAO,MAAM,WAAW,6FAAwB,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/http/http-methods.ts"],
|
|
4
|
+
"sourcesContent": ["/** All OpenAPI HTTP methods plus connect */\nexport const HTTP_METHODS = ['connect', '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 = new Set(HTTP_METHODS)\n"],
|
|
5
|
+
"mappings": "AACO,MAAM,eAAe,CAAC,WAAW,UAAU,OAAO,QAAQ,WAAW,SAAS,QAAQ,OAAO,OAAO;AAMpG,MAAM,cAAc,IAAI,IAAI,YAAY;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-status-codes.d.ts","sourceRoot":"","sources":["../../src/http/http-status-codes.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,cAAc,CAAC,CAAA;AAErE,eAAO,MAAM,eAAe,EAAE,eA4T7B,CAAA"}
|