@jacobhumston/roblox-openapi-ts 1.0.0 → 1.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/README.md +0 -2
- package/package.json +4 -5
- package/dist/bundle/index.d.ts +0 -69856
- package/dist/bundle/index.js +0 -1
package/dist/bundle/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var r=/\{[^{}]+\}/g,a=()=>{return typeof process==="object"&&Number.parseInt(process?.versions?.node?.substring(0,2))>=18&&process.versions.undici};function e(){return Math.random().toString(36).slice(2,11)}function p(K){let{baseUrl:G="",Request:$=globalThis.Request,fetch:V=globalThis.fetch,querySerializer:J,bodySerializer:W,pathSerializer:Z,headers:_,requestInitExt:M=void 0,...n}={...K};M=a()?M:void 0,G=d(G);let F=[];async function T(Y,X){let{baseUrl:O,fetch:z=V,Request:S=$,headers:f,params:Q={},parseAs:C="json",querySerializer:H,bodySerializer:P=W??G$,pathSerializer:l,body:y,middleware:t=[],...R}=X||{},U=G;if(O)U=d(O)??G;let w=typeof J==="function"?J:c(J);if(H)w=typeof H==="function"?H:c({...typeof J==="object"?J:{},...H});let v=l||Z||$$,b=y===void 0?void 0:P(y,m(_,f,Q.header)),s=m(b===void 0||b instanceof FormData?{}:{"Content-Type":"application/json"},_,f,Q.header),I=[...F,...t],i={redirect:"follow",...n,...R,body:b,headers:s},x,A,j=new S(J$(Y,{baseUrl:U,params:Q,querySerializer:w,pathSerializer:v}),i),N;for(let E in R)if(!(E in j))j[E]=R[E];if(I.length){x=e(),A=Object.freeze({baseUrl:U,fetch:z,parseAs:C,querySerializer:w,bodySerializer:P,pathSerializer:v});for(let E of I)if(E&&typeof E==="object"&&typeof E.onRequest==="function"){let D=await E.onRequest({request:j,schemaPath:Y,params:Q,options:A,id:x});if(D)if(D instanceof S)j=D;else if(D instanceof Response){N=D;break}else throw Error("onRequest: must return new Request() or Response() when modifying the request")}}if(!N){try{N=await z(j,M)}catch(E){let D=E;if(I.length)for(let k=I.length-1;k>=0;k--){let L=I[k];if(L&&typeof L==="object"&&typeof L.onError==="function"){let B=await L.onError({request:j,error:D,schemaPath:Y,params:Q,options:A,id:x});if(B){if(B instanceof Response){D=void 0,N=B;break}if(B instanceof Error){D=B;continue}throw Error("onError: must return new Response() or instance of Error")}}}if(D)throw D}if(I.length)for(let E=I.length-1;E>=0;E--){let D=I[E];if(D&&typeof D==="object"&&typeof D.onResponse==="function"){let k=await D.onResponse({request:j,response:N,schemaPath:Y,params:Q,options:A,id:x});if(k){if(!(k instanceof Response))throw Error("onResponse: must return new Response() when modifying the response");N=k}}}}let h=N.headers.get("Content-Length");if(N.status===204||j.method==="HEAD"||h==="0"&&!N.headers.get("Transfer-Encoding")?.includes("chunked"))return N.ok?{data:void 0,response:N}:{error:void 0,response:N};if(N.ok)return{data:await(async()=>{if(C==="stream")return N.body;if(C==="json"&&!h){let D=await N.text();return D?JSON.parse(D):void 0}return await N[C]()})(),response:N};let q=await N.text();try{q=JSON.parse(q)}catch{}return{error:q,response:N}}return{request(Y,X,O){return T(X,{...O,method:Y.toUpperCase()})},GET(Y,X){return T(Y,{...X,method:"GET"})},PUT(Y,X){return T(Y,{...X,method:"PUT"})},POST(Y,X){return T(Y,{...X,method:"POST"})},DELETE(Y,X){return T(Y,{...X,method:"DELETE"})},OPTIONS(Y,X){return T(Y,{...X,method:"OPTIONS"})},HEAD(Y,X){return T(Y,{...X,method:"HEAD"})},PATCH(Y,X){return T(Y,{...X,method:"PATCH"})},TRACE(Y,X){return T(Y,{...X,method:"TRACE"})},use(...Y){for(let X of Y){if(!X)continue;if(typeof X!=="object"||!(("onRequest"in X)||("onResponse"in X)||("onError"in X)))throw Error("Middleware must be an object with one of `onRequest()`, `onResponse() or `onError()`");F.push(X)}},eject(...Y){for(let X of Y){let O=F.indexOf(X);if(O!==-1)F.splice(O,1)}}}}function g(K,G,$){if(G===void 0||G===null)return"";if(typeof G==="object")throw Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");return`${K}=${$?.allowReserved===!0?G:encodeURIComponent(G)}`}function u(K,G,$){if(!G||typeof G!=="object")return"";let V=[],J={simple:",",label:".",matrix:";"}[$.style]||"&";if($.style!=="deepObject"&&$.explode===!1){for(let _ in G)V.push(_,$.allowReserved===!0?G[_]:encodeURIComponent(G[_]));let Z=V.join(",");switch($.style){case"form":return`${K}=${Z}`;case"label":return`.${Z}`;case"matrix":return`;${K}=${Z}`;default:return Z}}for(let Z in G){let _=$.style==="deepObject"?`${K}[${Z}]`:Z;V.push(g(_,G[Z],$))}let W=V.join(J);return $.style==="label"||$.style==="matrix"?`${J}${W}`:W}function o(K,G,$){if(!Array.isArray(G))return"";if($.explode===!1){let W={form:",",spaceDelimited:"%20",pipeDelimited:"|"}[$.style]||",",Z=($.allowReserved===!0?G:G.map((_)=>encodeURIComponent(_))).join(W);switch($.style){case"simple":return Z;case"label":return`.${Z}`;case"matrix":return`;${K}=${Z}`;default:return`${K}=${Z}`}}let V={simple:",",label:".",matrix:";"}[$.style]||"&",J=[];for(let W of G)if($.style==="simple"||$.style==="label")J.push($.allowReserved===!0?W:encodeURIComponent(W));else J.push(g(K,W,$));return $.style==="label"||$.style==="matrix"?`${V}${J.join(V)}`:J.join(V)}function c(K){return function($){let V=[];if($&&typeof $==="object")for(let J in $){let W=$[J];if(W===void 0||W===null)continue;if(Array.isArray(W)){if(W.length===0)continue;V.push(o(J,W,{style:"form",explode:!0,...K?.array,allowReserved:K?.allowReserved||!1}));continue}if(typeof W==="object"){V.push(u(J,W,{style:"deepObject",explode:!0,...K?.object,allowReserved:K?.allowReserved||!1}));continue}V.push(g(J,W,K))}return V.join("&")}}function $$(K,G){let $=K;for(let V of K.match(r)??[]){let J=V.substring(1,V.length-1),W=!1,Z="simple";if(J.endsWith("*"))W=!0,J=J.substring(0,J.length-1);if(J.startsWith("."))Z="label",J=J.substring(1);else if(J.startsWith(";"))Z="matrix",J=J.substring(1);if(!G||G[J]===void 0||G[J]===null)continue;let _=G[J];if(Array.isArray(_)){$=$.replace(V,o(J,_,{style:Z,explode:W}));continue}if(typeof _==="object"){$=$.replace(V,u(J,_,{style:Z,explode:W}));continue}if(Z==="matrix"){$=$.replace(V,`;${g(J,_)}`);continue}$=$.replace(V,Z==="label"?`.${encodeURIComponent(_)}`:encodeURIComponent(_))}return $}function G$(K,G){if(K instanceof FormData)return K;if(G){if((G.get instanceof Function?G.get("Content-Type")??G.get("content-type"):G["Content-Type"]??G["content-type"])==="application/x-www-form-urlencoded")return new URLSearchParams(K).toString()}return JSON.stringify(K)}function J$(K,G){let $=`${G.baseUrl}${K}`;if(G.params?.path)$=G.pathSerializer($,G.params.path);let V=G.querySerializer(G.params.query??{});if(V.startsWith("?"))V=V.substring(1);if(V)$+=`?${V}`;return $}function m(...K){let G=new Headers;for(let $ of K){if(!$||typeof $!=="object")continue;let V=$ instanceof Headers?$.entries():Object.entries($);for(let[J,W]of V)if(W===null)G.delete(J);else if(Array.isArray(W))for(let Z of W)G.append(J,Z);else if(W!==void 0)G.set(J,W)}return G}function d(K){if(K.endsWith("/"))return K.substring(0,K.length-1);return K}var _$=p({baseUrl:"https://apis.roblox.com"});export{_$ as client};
|