@stryke/http 0.5.1 â 0.5.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/README.md +1 -1
- package/dist/url-builder.cjs +1 -1
- package/dist/url-builder.mjs +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ This package is part of Storm Software's **đŠī¸ Stryke** monorepo. Stryke pac
|
|
|
22
22
|
|
|
23
23
|
<h3 align="center">đģ Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
24
24
|
|
|
25
|
-
[](https://prettier.io/) [](http://nx.dev/) [](https://nextjs.org/) [](http://commitizen.github.io/cz-cli/)  [](https://fumadocs.vercel.app/) 
|
|
26
26
|
|
|
27
27
|
> [!IMPORTANT] This repository, and the apps, libraries, and tools contained
|
|
28
28
|
> within, is still in it's initial development phase. As a result, bugs and
|
package/dist/url-builder.cjs
CHANGED
package/dist/url-builder.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{StormJSON as a}from"@stryke/json/storm-json";import{isString as e}from"@stryke/type-checks/is-string";import{cleanDoubleSlashes as h,decode as u,encode as p,parseAuth as o,parsePath as m,parseQuery as d,parseURL as n,stringifyParsedURL as l}from"ufo";export class StormURLBuilder{#t;static create(t,r){return new StormURLBuilder(t,r)}constructor(t,r){const s=r?.decode??!0,i=e(t)?s?n(u(t)):n(t):t;this.#t={__typename:"StormURL",queryParams:{},...i,paths:i.pathname?i.pathname.split("/").filter(Boolean):[]},this.#t.host&&this.withHost(this.#t.host),this.#t.auth&&this.withAuth(this.#t.auth)}get _url(){return this.#t}withProtocol(t){return this.#t.protocol=t,this}withHostname(t){return this.#t.hostname=t,this}withPort(t){return this.#t.port=String(t),this}withUsername(t){return this.#t.username=t,this}withPassword(t){return this.#t.password=t,this}withHost(t){if(e(t)){this.#t.host=t;const r=o(t);this.#t.username=r.username,this.#t.password=r.password}else this.#t.hostname=t.hostname,this.#t.port=t.port,this.#t.auth=`${t.hostname}${t.port?`:${t.port}`:""}`;return this}withPath(t){const r=m(t);return this.#t={...this.#t,...r,paths:r.pathname.split("/").filter(Boolean)},this}withHash(t){return this.#t.hash=t,this}withAuth(t){if(e(t)){this.#t.auth=t;const r=o(t);this.#t.username=r.username,this.#t.password=r.password}else this.#t.username=t.username,this.#t.password=t.password,this.#t.auth=`${t.username}:${t.password}`;return this}withQuery(t){return this.#t.queryParams={},this.addQueryParam(t),this}addQueryParam(t){if(e(t)){const r=d(t);for(const s of Object.entries(r))s[0]&&(this.#t.queryParams[s[0]]=this.parseQueryParamValue(s[1]))}else if(Array.isArray(t)&&t.length===2)this.#t.queryParams[t[0]]=this.parseQueryParamValue(t[1]);else for(const r of Object.entries(t))r[0]&&(this.#t.queryParams[r[0]]=this.parseQueryParamValue(r[1]));return this}build(){return this.#t}toString(){return h(l(this.#t))}toEncoded(){return p(this.toString())}parseQueryParamValue(t){if(Array.isArray(t)){const r=[];for(const s of t)r.push(this.parseQueryParamValue(s));return r}return a.parse(t)}}
|
|
1
|
+
import{StormJSON as a}from"@stryke/json/storm-json";import{isString as e}from"@stryke/type-checks/is-string";import{cleanDoubleSlashes as h,decode as u,encode as p,parseAuth as o,parsePath as m,parseQuery as d,parseURL as n,stringifyParsedURL as l}from"ufo";export class StormURLBuilder{#t;static create(t,r){return new StormURLBuilder(t,r)}constructor(t,r){const s=r?.decode??!0,i=e(t)?s?n(u(t)):n(t):t;this.#t={__typename:"StormURL",queryParams:{},...i,paths:i.pathname?i.pathname.split("/").filter(Boolean):[]},this.#t.host&&this.withHost(this.#t.host),this.#t.auth&&this.withAuth(this.#t.auth)}get _url(){return this.#t}withProtocol(t){return this.#t.protocol=t,this}withHostname(t){return this.#t.hostname=t,this}withPort(t){return this.#t.port=String(t),this}withUsername(t){return this.#t.username=t,this}withPassword(t){return this.#t.password=t,this}withHost(t){if(e(t)){this.#t.host=t;const r=o(t);this.#t.username=r.username,this.#t.password=r.password}else this.#t.hostname=t.hostname,this.#t.port=t.port,this.#t.auth=`${t.hostname}${t.port?`:${t.port}`:""}`;return this}withPath(t){const r=m(t.startsWith("/")?t:`/${t}`);return this.#t={...this.#t,...r,paths:r.pathname.split("/").filter(Boolean)},this}withHash(t){return this.#t.hash=t,this}withAuth(t){if(e(t)){this.#t.auth=t;const r=o(t);this.#t.username=r.username,this.#t.password=r.password}else this.#t.username=t.username,this.#t.password=t.password,this.#t.auth=`${t.username}:${t.password}`;return this}withQuery(t){return this.#t.queryParams={},this.addQueryParam(t),this}addQueryParam(t){if(e(t)){const r=d(t);for(const s of Object.entries(r))s[0]&&(this.#t.queryParams[s[0]]=this.parseQueryParamValue(s[1]))}else if(Array.isArray(t)&&t.length===2)this.#t.queryParams[t[0]]=this.parseQueryParamValue(t[1]);else for(const r of Object.entries(t))r[0]&&(this.#t.queryParams[r[0]]=this.parseQueryParamValue(r[1]));return this}build(){return this.#t}toString(){return h(l(this.#t))}toEncoded(){return p(this.toString())}parseQueryParamValue(t){if(Array.isArray(t)){const r=[];for(const s of t)r.push(this.parseQueryParamValue(s));return r}return a.parse(t)}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stryke/http",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing HTTP communication utilities used by Storm Software.",
|
|
6
6
|
"repository": {
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"private": false,
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"ufo": "1.5.4",
|
|
14
|
-
"@stryke/json": ">=0.5.
|
|
15
|
-
"@stryke/type-checks": ">=0.1.
|
|
14
|
+
"@stryke/json": ">=0.5.4",
|
|
15
|
+
"@stryke/type-checks": ">=0.1.4"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": { "@types/node": "^22.13.1" },
|
|
18
18
|
"publishConfig": { "access": "public" },
|