@qgisk/steamresolver
Advanced tools
Comparing version 2.1.3 to 3.0.0
@@ -0,0 +0,0 @@ /** |
@@ -0,0 +0,0 @@ import { convertableToString } from 'xml2js'; |
declare class SteamResolver { | ||
static BaseURL: string; | ||
fetch: Function; | ||
/** | ||
* @example Cloudflare workers example fetch = (...args) => fetch(...args) | ||
*/ | ||
constructor(fetch: Function); | ||
/** | ||
* From id to custom url | ||
@@ -5,0 +10,0 @@ */ |
@@ -1,1 +0,1 @@ | ||
var D=Object.create;var u=Object.defineProperty;var I=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var d=Object.getPrototypeOf,L=Object.prototype.hasOwnProperty;var f=t=>u(t,"__esModule",{value:!0});var R=(t,r)=>{for(var s in r)u(t,s,{get:r[s],enumerable:!0})},g=(t,r,s,n)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of $(r))!L.call(t,o)&&(s||o!=="default")&&u(t,o,{get:()=>r[o],enumerable:!(n=I(r,o))||n.enumerable});return t},x=(t,r)=>g(f(u(t!=null?D(d(t)):{},"default",!r&&t&&t.__esModule?{get:()=>t.default,enumerable:!0}:{value:t,enumerable:!0})),t),U=(t=>(r,s)=>t&&t.get(r)||(s=g(f({}),r,1),t&&t.set(r,s),s))(typeof WeakMap!="undefined"?new WeakMap:0);var N={};R(N,{SteamResolver:()=>m,default:()=>m});var h=x(require("isomorphic-unfetch"));var y=require("xml2js");var a=(t,r)=>String(t).includes(r),b=t=>new y.Parser().parseStringPromise(t).then(r=>r.profile?r.profile:r.memberList?r.memberList:new Error("Resource cannot be found.")).catch(r=>r),i=t=>{if(t.includes("steamcommunity.com/")){let r=t.split("/"),s=t.endsWith("/")?2:1;return r[r.length-s]}return t};var e="https://steamcommunity.com";var m=class{async toCustomURL(r){let s=i(r),n=`${e}/profiles/${s}`;return this._request(n,"customURL")}async fromCustomURL(r){let s=i(r),n=`${e}/id/${s}`;return this._request(n,"steamID64")}async fromIDToProfile(r){let s=i(r),n=`${e}/profiles/${s}`;return this._request(n)}async fromCustomToProfile(r){let s=i(r),n=`${e}/id/${s}`;return this._request(n)}async fromGroupURLToID(r){let s=i(r),n=`${e}/groups/${s}/memberslistxml`;return this._request(n,"groupID64")}async fromGIDToCustomURL(r){let s=i(r),n=`${e}/gid/${s}/memberslistxml`;return(await this._request(n,"groupDetails")).groupURL[0]}async fromGroupUrlToProfile(r){let s=i(r),n=`${e}/groups/${s}/memberslistxml`;return this._request(n)}async fromGIDToProfile(r){let s=i(r),n=`${e}/gid/${s}/memberslistxml`;return this._request(n)}async _request(r,s){return new Promise((n,o)=>{(0,h.default)(`${r}?xml=1`).then(c=>c.text()).then(async c=>{!a(c,"<?xml")&&a(c,"<error>")&&o(new Error("Resource cannot be found"));let l=await b(c);s&&n(l[s][0]),n(l)}).catch(c=>o(c))})}};m.BaseURL=e;module.exports=U(N);0&&(module.exports={SteamResolver}); | ||
var u=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var h=Object.prototype.hasOwnProperty;var D=n=>u(n,"__esModule",{value:!0});var I=(n,r)=>{for(var t in r)u(n,t,{get:r[t],enumerable:!0})},$=(n,r,t,s)=>{if(r&&typeof r=="object"||typeof r=="function")for(let o of b(r))!h.call(n,o)&&(t||o!=="default")&&u(n,o,{get:()=>r[o],enumerable:!(s=p(r,o))||s.enumerable});return n};var d=(n=>(r,t)=>n&&n.get(r)||(t=$(D({}),r,1),n&&n.set(r,t),t))(typeof WeakMap!="undefined"?new WeakMap:0);var L={};I(L,{SteamResolver:()=>m,default:()=>m});var g=require("xml2js");var a=(n,r)=>String(n).includes(r),y=n=>new g.Parser().parseStringPromise(n).then(r=>r.profile?r.profile:r.memberList?r.memberList:new Error("Resource cannot be found.")).catch(r=>r),i=n=>{if(n.includes("steamcommunity.com/")){let r=n.split("/"),t=n.endsWith("/")?2:1;return r[r.length-t]}return n};var e="https://steamcommunity.com";var m=class{constructor(r){this.fetch=r}async toCustomURL(r){let t=i(r),s=`${e}/profiles/${t}`;return this._request(s,"customURL")}async fromCustomURL(r){let t=i(r),s=`${e}/id/${t}`;return this._request(s,"steamID64")}async fromIDToProfile(r){let t=i(r),s=`${e}/profiles/${t}`;return this._request(s)}async fromCustomToProfile(r){let t=i(r),s=`${e}/id/${t}`;return this._request(s)}async fromGroupURLToID(r){let t=i(r),s=`${e}/groups/${t}/memberslistxml`;return this._request(s,"groupID64")}async fromGIDToCustomURL(r){let t=i(r),s=`${e}/gid/${t}/memberslistxml`;return(await this._request(s,"groupDetails")).groupURL[0]}async fromGroupUrlToProfile(r){let t=i(r),s=`${e}/groups/${t}/memberslistxml`;return this._request(s)}async fromGIDToProfile(r){let t=i(r),s=`${e}/gid/${t}/memberslistxml`;return this._request(s)}async _request(r,t){return new Promise((s,o)=>{this.fetch(`${r}?xml=1`).then(c=>c.text()).then(async c=>{!a(c,"<?xml")&&a(c,"<error>")&&o(new Error("Resource cannot be found"));let l=await y(c);t&&s(l[t][0]),s(l)}).catch(c=>o(c))})}};m.BaseURL=e;module.exports=d(L);0&&(module.exports={SteamResolver}); |
{ | ||
"name": "@qgisk/steamresolver", | ||
"version": "2.1.3", | ||
"version": "3.0.0", | ||
"main": "./dist/index.js", | ||
@@ -61,2 +61,3 @@ "module": "./dist/index.mjs", | ||
"tsup": "^5.11.1", | ||
"isomorphic-unfetch": "^3.1.0", | ||
"typescript": "^4.5.3" | ||
@@ -66,3 +67,2 @@ }, | ||
"dependencies": { | ||
"isomorphic-unfetch": "^3.1.0", | ||
"xml2js": "^0.4.23" | ||
@@ -69,0 +69,0 @@ }, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1
116
14873
19
14
- Removedisomorphic-unfetch@^3.1.0
- Removedisomorphic-unfetch@3.1.0(transitive)
- Removednode-fetch@2.7.0(transitive)
- Removedtr46@0.0.3(transitive)
- Removedunfetch@4.2.0(transitive)
- Removedwebidl-conversions@3.0.1(transitive)
- Removedwhatwg-url@5.0.0(transitive)