@cybearl/cypack 1.8.0 → 1.8.1

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/frontend.js CHANGED
@@ -1,2 +1,2 @@
1
- async function i(n=!1,r="/api/cgas"){return await(await fetch(`${r}/status?markerOnly=${n}`)).json()}function o(n,r){let e=n;for(let[s,t]of Object.entries(r))t==null||t===""||t==="null"||t==="undefined"||(e+=`${e.includes("?")?"&":"?"}${s}=${t.toString()}`);return e}var u=typeof window<"u"&&window.location.origin?window.location.origin:null;export{o as addParamsToUrl,u as currentUrlOrigin,i as getCGASStatus};//# sourceMappingURL=frontend.js.map
1
+ async function o(n=!1,r="/api/cgas"){return await(await fetch(`${r}/status?markerOnly=${n}`)).json()}function i(n,r){let e=n;for(let[s,t]of Object.entries(r))t==null||t===""||t==="null"||t==="undefined"||(e+=`${e.includes("?")?"&":"?"}${encodeURIComponent(s)}=${encodeURIComponent(t.toString())}`);return e}var u=typeof window<"u"&&window.location.origin?window.location.origin:null;export{i as addParamsToUrl,u as currentUrlOrigin,o as getCGASStatus};//# sourceMappingURL=frontend.js.map
2
2
  //# sourceMappingURL=frontend.js.map
package/frontend.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/frontend/cgas/status.ts","../src/frontend/urls.ts"],"names":["getCGASStatus","markerOnly","baseUrl","addParamsToUrl","params","url","key","value","currentUrlOrigin"],"mappings":"AAWA,eAAsBA,CACrBC,CAAAA,CAAAA,CAAa,CACbC,CAAAA,CAAAA,CAAAA,CAAU,YACoC,CAG9C,OADe,KADE,CAAA,MAAM,MAAM,CAAGA,EAAAA,CAAO,CAAsBD,mBAAAA,EAAAA,CAAU,EAAE,CAC3C,EAAA,IAAA,EAE/B,CCZO,SAASE,CAAAA,CACfD,CACAE,CAAAA,CAAAA,CAGC,CACD,IAAIC,CAAAA,CAAMH,CAEV,CAAA,IAAA,GAAW,CAACI,CAAKC,CAAAA,CAAK,CAAK,GAAA,MAAA,CAAO,QAAQH,CAAM,CAAA,CACpBG,CAAU,EAAA,IAAA,EAAQA,CAAU,GAAA,EAAA,EAAMA,CAAU,GAAA,MAAA,EAAUA,IAAU,WAI3FF,GAAAA,CAAAA,EAAO,CAAGA,EAAAA,CAAAA,CAAI,SAAS,GAAG,CAAA,CAAI,GAAM,CAAA,GAAG,GAAGC,CAAG,CAAA,CAAA,EAAIC,CAAM,CAAA,QAAA,EAAU,CAAA,CAAA,CAAA,CAGlE,OAAOF,CACR,CAKaG,IAAAA,CAAAA,CAAmB,OAAO,MAAA,CAAW,KAAe,MAAO,CAAA,QAAA,CAAS,MAAS,CAAA,MAAA,CAAO,SAAS,MAAS,CAAA","file":"frontend.js","sourcesContent":["import type { CGASStatus } from \"@/main/types/cgas\"\nimport type { RequestResult } from \"@/main/types/requests\"\n\n/**\n * Get the status of the application via the CGAS API endpoint (that itself uses the `getCGASStatus` function).\n * @param markerOnly Whether to only return the marker (optional, defaults to false).\n * @param baseUrl The base URL of the CGAS API (optional, defaults to \"/api/cgas\").\n * @returns The status of the application, or the marker if `markerOnly` is true.\n */\nexport async function getCGASStatus(markerOnly: true, baseUrl?: string): Promise<RequestResult<string>>\nexport async function getCGASStatus(markerOnly?: false, baseUrl?: string): Promise<RequestResult<CGASStatus>>\nexport async function getCGASStatus(\n\tmarkerOnly = false,\n\tbaseUrl = \"/api/cgas\",\n): Promise<RequestResult<CGASStatus | string>> {\n\tconst response = await fetch(`${baseUrl}/status?markerOnly=${markerOnly}`)\n\tconst result = await response.json()\n\treturn result as RequestResult<CGASStatus | string>\n}\n","/**\n * Allows to add query parameters to a URL.\n * @param baseUrl The base URL to add parameters to.\n * @param params The parameters to add.\n * @returns The URL with the parameters added.\n */\nexport function addParamsToUrl(\n\tbaseUrl: string,\n\tparams: {\n\t\t[key: string]: string | number | boolean | undefined | null\n\t},\n) {\n\tlet url = baseUrl\n\n\tfor (const [key, value] of Object.entries(params)) {\n\t\tif (value === undefined || value === null || value === \"\" || value === \"null\" || value === \"undefined\") {\n\t\t\tcontinue\n\t\t}\n\n\t\turl += `${url.includes(\"?\") ? \"&\" : \"?\"}${key}=${value.toString()}`\n\t}\n\n\treturn url\n}\n\n/**\n * Get the current URL origin or null if it's not available.\n */\nexport const currentUrlOrigin = typeof window !== \"undefined\" && window.location.origin ? window.location.origin : null\n"]}
1
+ {"version":3,"sources":["../src/frontend/cgas/status.ts","../src/frontend/urls.ts"],"names":["getCGASStatus","markerOnly","baseUrl","addParamsToUrl","params","url","key","value","currentUrlOrigin"],"mappings":"AAWA,eAAsBA,EACrBC,CAAa,CAAA,CAAA,CAAA,CACbC,CAAU,CAAA,WAAA,CACoC,CAG9C,OADe,KAAA,CADE,MAAM,KAAA,CAAM,GAAGA,CAAO,CAAA,mBAAA,EAAsBD,CAAU,CAAA,CAAE,GAC3C,IAAK,EAEpC,CCZO,SAASE,EACfD,CACAE,CAAAA,CAAAA,CAGC,CACD,IAAIC,EAAMH,CAEV,CAAA,IAAA,GAAW,CAACI,CAAAA,CAAKC,CAAK,CAAK,GAAA,MAAA,CAAO,OAAQH,CAAAA,CAAM,EACpBG,CAAU,EAAA,IAAA,EAAQA,CAAU,GAAA,EAAA,EAAMA,IAAU,MAAUA,EAAAA,CAAAA,GAAU,WAI3FF,GAAAA,CAAAA,EAAO,GAAGA,CAAI,CAAA,QAAA,CAAS,GAAG,CAAA,CAAI,IAAM,GAAG,CAAA,EAAG,kBAAmBC,CAAAA,CAAG,CAAC,CAAI,CAAA,EAAA,kBAAA,CAAmBC,CAAM,CAAA,QAAA,EAAU,CAAC,CAAA,CAAA,CAAA,CAG1G,OAAOF,CACR,CAKaG,IAAAA,CAAAA,CAAmB,OAAO,MAAA,CAAW,KAAe,MAAO,CAAA,QAAA,CAAS,MAAS,CAAA,MAAA,CAAO,SAAS,MAAS,CAAA","file":"frontend.js","sourcesContent":["import type { CGASStatus } from \"@/main/types/cgas\"\nimport type { RequestResult } from \"@/main/types/requests\"\n\n/**\n * Get the status of the application via the CGAS API endpoint (that itself uses the `getCGASStatus` function).\n * @param markerOnly Whether to only return the marker (optional, defaults to false).\n * @param baseUrl The base URL of the CGAS API (optional, defaults to \"/api/cgas\").\n * @returns The status of the application, or the marker if `markerOnly` is true.\n */\nexport async function getCGASStatus(markerOnly: true, baseUrl?: string): Promise<RequestResult<string>>\nexport async function getCGASStatus(markerOnly?: false, baseUrl?: string): Promise<RequestResult<CGASStatus>>\nexport async function getCGASStatus(\n\tmarkerOnly = false,\n\tbaseUrl = \"/api/cgas\",\n): Promise<RequestResult<CGASStatus | string>> {\n\tconst response = await fetch(`${baseUrl}/status?markerOnly=${markerOnly}`)\n\tconst result = await response.json()\n\treturn result as RequestResult<CGASStatus | string>\n}\n","/**\n * Allows to add query parameters to a URL.\n * @param baseUrl The base URL to add parameters to.\n * @param params The parameters to add.\n * @returns The URL with the parameters added.\n */\nexport function addParamsToUrl(\n\tbaseUrl: string,\n\tparams: {\n\t\t[key: string]: string | number | boolean | undefined | null\n\t},\n) {\n\tlet url = baseUrl\n\n\tfor (const [key, value] of Object.entries(params)) {\n\t\tif (value === undefined || value === null || value === \"\" || value === \"null\" || value === \"undefined\") {\n\t\t\tcontinue\n\t\t}\n\n\t\turl += `${url.includes(\"?\") ? \"&\" : \"?\"}${encodeURIComponent(key)}=${encodeURIComponent(value.toString())}`\n\t}\n\n\treturn url\n}\n\n/**\n * Get the current URL origin or null if it's not available.\n */\nexport const currentUrlOrigin = typeof window !== \"undefined\" && window.location.origin ? window.location.origin : null\n"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cybearl/cypack",
3
3
  "productName": "CyPack",
4
- "version": "1.8.0",
4
+ "version": "1.8.1",
5
5
  "description": "A set of general utilities for Cybearl projects.",
6
6
  "author": "Cybearl <contact@cybearl.com> (https://www.cybearl.com/)",
7
7
  "license": "MIT",