New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

flarepc

Package Overview
Dependencies
Maintainers
0
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

flarepc - npm Package Compare versions

Comparing version 0.0.22 to 0.0.23

dist/types-D8sPNuII.d.mts

2

dist/client.d.ts

@@ -1,2 +0,2 @@

import type { n as Server, M as MaybePromise, C as Client } from './types-Cv_B-7xd.js';
import type { n as Server, M as MaybePromise, C as Client } from './types-D8sPNuII.js';
import 'cookie';

@@ -3,0 +3,0 @@ import 'valibot';

@@ -1,2 +0,2 @@

import type { a as RequestEvent } from './types-Cv_B-7xd.js';
import type { a as RequestEvent } from './types-D8sPNuII.js';
import 'cookie';

@@ -3,0 +3,0 @@ import 'valibot';

@@ -1,3 +0,3 @@

import type { R as Router, H as Handler, L as Locals, E as Env, M as MaybePromise, a as RequestEvent, D as DurableRouter, S as StreamCallback } from './types-Cv_B-7xd.js';
export { A as API, C as Client, u as ConnectOptions, B as Cookies, o as DurableServer, G as Get, k as HandleFunction, l as HandlePayload, I as InferDurableServer, r as InferInputAtPath, t as InferOutPutAtPath, s as InferSchemaOutPutAtPath, j as Middleware, b as Register, e as RegisteredObjects, f as RegisteredParticipant, c as RegisteredRouter, m as ReturnOfMiddlewares, q as RouterPaths, g as Schema, h as SchemaInput, i as SchemaOutput, n as Server, W as WebSocketClient, z as createCookies, w as createHandler, y as createReceiver, x as createSender, v as createWebSocketConnection, d as durableProcedure, p as procedure } from './types-Cv_B-7xd.js';
import type { R as Router, H as Handler, L as Locals, E as Env, M as MaybePromise, a as RequestEvent, D as DurableRouter, S as StreamCallback } from './types-D8sPNuII.js';
export { A as API, C as Client, u as ConnectOptions, F as Cookies, o as DurableServer, G as Get, k as HandleFunction, l as HandlePayload, I as InferDurableServer, r as InferInputAtPath, t as InferOutPutAtPath, s as InferSchemaOutPutAtPath, j as Middleware, b as Register, e as RegisteredObjects, f as RegisteredParticipant, c as RegisteredRouter, m as ReturnOfMiddlewares, q as RouterPaths, g as Schema, h as SchemaInput, i as SchemaOutput, n as Server, W as WebSocketClient, B as createCookies, w as createDurableRouter, x as createHandler, z as createReceiver, y as createSender, v as createWebSocketConnection, d as durableProcedure, p as procedure } from './types-D8sPNuII.js';
import type { CorsPair } from './cors.js';

@@ -4,0 +4,0 @@ export { CorsOptions, Corsify, GenericTraps, IRequest, IRequestStrict, Preflight, cors } from './cors.js';

@@ -6,29 +6,30 @@ 'use strict';

var U=(r,e,t={})=>{let n=`${r}=${e}`;return t&&typeof t.maxAge=="number"&&t.maxAge>=0&&(n+=`; Max-Age=${Math.floor(t.maxAge)}`),t.domain&&(n+=`; Domain=${t.domain}`),t.path&&(n+=`; Path=${t.path}`),t.expires&&(n+=`; Expires=${t.expires.toUTCString()}`),t.httpOnly&&(n+="; HttpOnly"),t.secure&&(n+="; Secure"),t.sameSite&&(n+=`; SameSite=${t.sameSite}`),t.partitioned&&(n+="; Partitioned"),n},v=r=>{let e=new Map,t=new Map,n=()=>{let i=r.headers.get("cookie");if(i)for(var l=0;l<i.length;){var p=i.indexOf("=",l);if(p===-1)break;var c=i.indexOf(";",l);if(c===-1)c=i.length;else if(c<p){l=i.lastIndexOf(";",p-1)+1;continue}var u=i.slice(l,p).trim();if(!e.has(u)){var f=i.slice(p+1,c).trim();f.charCodeAt(0)===34&&(f=f.slice(1,-1)),e.set(u,decodeURIComponent(f));}l=c+1;}};return {get:i=>(e||n(),e.get(i)),set:(i,l,p)=>{t.set(i,{value:l,options:p});},delete:(i,l)=>{t.set(i,{value:"",options:{...l,expires:new Date(0)}});},cookiefy:i=>(t.size>0&&i.headers.set("Set-Cookie",Array.from(t.entries()).map(([l,{value:p,options:c}])=>U(l,encodeURIComponent(p),c)).join("; ")),i)}};var D={BAD_REQUEST:{code:400,message:"Bad Request"},UNAUTHORIZED:{code:401,message:"Unauthorized"},FORBIDDEN:{code:403,message:"Forbidden"},NOT_FOUND:{code:404,message:"Not Found"},METHOD_NOT_SUPPORTED:{code:405,message:"Method Not Supported"},TIMEOUT:{code:408,message:"Timeout"},CONFLICT:{code:409,message:"Conflict"},PRECONDITION_FAILED:{code:412,message:"Precondition Failed"},PAYLOAD_TOO_LARGE:{code:413,message:"Payload Too Large"},UNSUPPORTED_MEDIA_TYPE:{code:415,message:"Unsupported Media Type"},UNPROCESSABLE_CONTENT:{code:422,message:"Unprocessable Content"},TOO_MANY_REQUESTS:{code:429,message:"Too Many Requests"},CLIENT_CLOSED_REQUEST:{code:499,message:"Client Closed Request"},INTERNAL_SERVER_ERROR:{code:500,message:"Internal Server Error"},NOT_IMPLEMENTED:{code:501,message:"Not Implemented"},BAD_GATEWAY:{code:502,message:"Bad Gateway"},SERVICE_UNAVAILABLE:{code:503,message:"Service Unavailable"},GATEWAY_TIMEOUT:{code:504,message:"Gateway Timeout"}},R=class extends Error{constructor(e,t){super(e),this.code=e,this.message=t||D[e].message;}},g=(r,e)=>{throw new R(r,e)},O=r=>r instanceof R?new Response(JSON.stringify({error:{message:r.message}}),{status:D[r.code].code,statusText:r.message}):new Response(JSON.stringify(r,Object.getOwnPropertyNames(r)),{status:r.code||500,statusText:r.message||"Internal Server Error"});var E={stringify:r=>{if(r instanceof URL)return r.toString()},parse:r=>new URL(r)},x=r=>devalue.stringify(r,{URL:E.stringify}),N=r=>devalue.parse(r,{URL:E.parse}),k=(r,e=new FormData)=>{let t=devalue.stringify(r,{File:n=>{if(n instanceof File)return e.append(n.name,n),n.name},URL:E.stringify});return e.set("value",t),e},q=r=>{let e=r.get("value");return devalue.parse(e,{File:n=>r.get(n),URL:E.parse})};var I=r=>{try{return typeof r!="string"?r:JSON.parse(r)}catch{return r}};var y=(r,e)=>{if(r!==void 0){let t=r.safeParse?.(e)||r._parse?.(e),n=t?.error?.issues||t.issues;if(n)throw new Error(JSON.stringify(n));return t.data||t.output}},A=async(r,e)=>{let t={};if(r)for(let n of r)Object.assign(t,await n(e));return t};var S=async(r,e)=>{let t=r.request,n=r.url,o=r.request.method,s=r.request.headers.get("x-flarepc-client")==="true",a=JSON.stringify({error:{message:"Not Found"}}),d={"Content-Type":"application/json"},i=o==="GET"?JSON.parse(decodeURIComponent(new URLSearchParams(n.search).get("input")||"{}")):s?q(await t.formData()):await t.json();return e&&"call"in e&&(a=await e.call(r,y(e.schema,i)),a?.constructor.name==="ReadableStream"?d["Content-Type"]="text/event-stream":a&&a instanceof File?d={"Content-Type":a.type,"Content-Disposition":"attachment; filename="+a.name}:(s?delete d["Content-Type"]:d={"Content-Type":"application/json"},a=s?k(a):JSON.stringify(a))),new Response(a,{headers:d,status:200})};var h=(r,e)=>{let t=r;return e.forEach(n=>{t=t?.[n]?t?.[n]:void 0;}),t||null},C=async(r,e,t,n)=>{let o=new URL(r.url),s=o.pathname.split("/").filter(Boolean),a=r.headers.get("x-flarepc-object-id")||null,d=r.headers.get("x-flarepc-object-name")||null,i=r.method;return i!=="POST"&&s.push(i.toLocaleLowerCase()),a&&d&&(s=s.slice(1)),Object.assign({},{path:s,locals:typeof e=="function"?await e(r,t,n):e,objectId:a,objectName:d,request:r,url:o,caches,cookies:v(r)})},w=(r,e,t)=>Object.assign({},t,r,e),X=({router:r,before:e=[],after:t=[],locals:n={},cors:o,catch:s,objects:a})=>({async fetch(d,i,l){let p=await C(d,n,i,l),c=w(p,i,l),u;e:try{for(let m of e.concat(o?.preflight||[])||[])if(u=await m(c)??u,u)break e;if(c.objectName?a?.[c.objectName]:null){let m=i[c.objectName].idFromName(c.objectId);u=await i[c.objectName].get(m).handleRpc(d,n);}else {let m=h(r,c.path);m?u=await S(c,m):g("NOT_FOUND");}}catch(f){console.log({error:f}),s?.(f),u=O(f);}for(let f of t.concat(o?.corsify||[])||[])u=await f(u,c)??u;return u}});var H=(r,e)=>t=>new b(r,e,t),j=(...r)=>({handle:e=>H(r,void 0)(e),input:e=>({handle:t=>H(r,e)(t)})}),re=()=>(...r)=>j(...r),b=class{constructor(e,t,n){this.call=async(e,t,n)=>this.handleFunction({event:e,input:t,ctx:await A(this.middlewares,e),object:n});this.middlewares=e,this.schema=t,this.handleFunction=n;}};var P=class{constructor(e,t,n){this.state="CLOSED";this.abortController=new AbortController;this.send=(e,t)=>{console.log(e,t);};this.ws=new WebSocket(t,Object.entries(e.headers||{}).reduce((o,[s,a])=>(o.push(`${s}: ${a}`),o),[])),this.state="CONNECTING",this.ws.addEventListener("open",()=>{this.ws.send(JSON.stringify({type:"connect",data:e.participant})),n?.(this),e.onOpen?.();},{signal:this.abortController.signal}),this.ws.addEventListener("close",()=>{this.state="CLOSED",e.onClose?.();},{signal:this.abortController.signal}),this.ws.addEventListener("message",o=>{let{type:s,data:a}=N(o.data);s==="ping"?this.ws.send("pong"):s==="connect"?this.state:e.messages[s]?.({data:a,ctx:a});},{signal:this.abortController.signal}),this.participant=e.participant;}destroy(){this.ws.close(),this.abortController.abort();}},oe=(r,e)=>new Promise((t,n)=>{new P(r,e,t);});var L=class extends cloudflare_workers.DurableObject{constructor(t,n,o,s,a){super(t,n);this.onMessage=t=>{"receive"in this&&typeof this.receive=="function"&&this.receive(t.type,t.data);};this.router=o,s&&a&&(this.topics={in:s,out:a}),this.state=t,this.storage=t.storage,this.env=n,this.sessions=new Map,this.lastTimestamp=0,this.currentlyConnectedWebSockets=0;}async fetch(t){if(t.url==="/connect"){let n=new WebSocketPair,[o,s]=Object.values(n);return s.accept(),this.currentlyConnectedWebSockets+=1,this.ws=s,s.addEventListener("message",a=>{a.type==="ping"?s.send("pong"):this.onMessage(a);}),s.addEventListener("open",()=>{}),s.addEventListener("close",a=>{this.currentlyConnectedWebSockets=Math.min(this.currentlyConnectedWebSockets-1,0),this.currentlyConnectedWebSockets===0&&s.close(a.code,"Durable Object is closing WebSocket");},{signal:new AbortController().signal}),s.send("Hello from client"),new Response(null,{status:101,webSocket:o})}else return new Response(null,{status:101})}async handleRpc(t,n){try{let o=await C(t,n,this.env,{}),s=w(o,this.env,{}),a=h(this.router,s.path);if(!a)g("NOT_FOUND");else return S(s,a)}catch(o){return O(o)}}getRouter(){return this.router}},fe=(r,e)=>async(t,n,o)=>{let s=h(r,String(n).split("/"));if(s)return s.call(t,o,e);throw g("NOT_FOUND")},me=(r,e)=>async(t,n)=>{let o=h(r,String(t).split("/")),s=await y(o?.schema,n),a=await o?.call(e.requestEvent,s,e);e.ws?.send(x({type:t,data:s,ctx:a}));},Re=(r,e)=>async(t,n)=>{try{let o=h(r,String(t).split("/")),s=await y(o?.schema,n);await o?.call(e.requestEvent,s,e);}catch(o){o instanceof R?e.ws?.send(x({type:"error",topic:t,error:{message:o.message,code:o.code}})):e.ws?.send(x({type:"error",topic:t,error:JSON.stringify(o,Object.getOwnPropertyNames(o))}));}};var ge=(r={})=>{let{origin:e="*",credentials:t=!1,allowMethods:n="*",allowHeaders:o="*",exposeHeaders:s="*",maxAge:a}=r,d={"access-control-allow-headers":o?.join?.(",")??o,"access-control-expose-headers":s?.join?.(",")??s,"access-control-allow-methods":n?.join?.(",")??n,"access-control-max-age":a,"access-control-allow-credentials":t},i=c=>{let u=c?.headers.get("origin");return e===!0?u:e instanceof RegExp?e.test(u)?u:void 0:Array.isArray(e)?e.includes(u)?u:void 0:e instanceof Function?e(u):e=="*"&&t?u:e};return {corsify:(c,u)=>{c.headers.has("access-control-allow-origin")||(c.headers.set("access-control-allow-origin",i(u.request)),Object.entries(d).forEach(([f,m])=>{c.headers.set(f,m);}));},preflight:c=>{if(c.request.method=="OPTIONS")return new Response(null,{status:204,headers:Object.entries({"access-control-allow-origin":i(c.request),...d}).filter(u=>u[1])})}}};var Ee=(r,e)=>{let t=r.getReader(),n=[],o=!0,s=new TextDecoder;return [new ReadableStream({start(d){e?.onStart?.();let i=async()=>{let{done:l,value:p}=await t.read();if(l){d.close(),e?.onEnd?.(n);return}else if(p){let c=I(s.decode(p));n.push(c),e?.onChunk?.({chunk:c,first:o}),o=!1;}d.enqueue(p),i();};i();}}),{"Content-Type":"text/event-stream"}]};
var U=(r,e,t={})=>{let n=`${r}=${e}`;return t&&typeof t.maxAge=="number"&&t.maxAge>=0&&(n+=`; Max-Age=${Math.floor(t.maxAge)}`),t.domain&&(n+=`; Domain=${t.domain}`),t.path&&(n+=`; Path=${t.path}`),t.expires&&(n+=`; Expires=${t.expires.toUTCString()}`),t.httpOnly&&(n+="; HttpOnly"),t.secure&&(n+="; Secure"),t.sameSite&&(n+=`; SameSite=${t.sameSite}`),t.partitioned&&(n+="; Partitioned"),n},D=r=>{let e=new Map,t=new Map,n=()=>{let i=r.headers.get("cookie");if(i)for(var l=0;l<i.length;){var p=i.indexOf("=",l);if(p===-1)break;var c=i.indexOf(";",l);if(c===-1)c=i.length;else if(c<p){l=i.lastIndexOf(";",p-1)+1;continue}var u=i.slice(l,p).trim();if(!e.has(u)){var f=i.slice(p+1,c).trim();f.charCodeAt(0)===34&&(f=f.slice(1,-1)),e.set(u,decodeURIComponent(f));}l=c+1;}};return {get:i=>(e||n(),e.get(i)),set:(i,l,p)=>{t.set(i,{value:l,options:p});},delete:(i,l)=>{t.set(i,{value:"",options:{...l,expires:new Date(0)}});},cookiefy:i=>(t.size>0&&i.headers.set("Set-Cookie",Array.from(t.entries()).map(([l,{value:p,options:c}])=>U(l,encodeURIComponent(p),c)).join("; ")),i)}};var T={BAD_REQUEST:{code:400,message:"Bad Request"},UNAUTHORIZED:{code:401,message:"Unauthorized"},FORBIDDEN:{code:403,message:"Forbidden"},NOT_FOUND:{code:404,message:"Not Found"},METHOD_NOT_SUPPORTED:{code:405,message:"Method Not Supported"},TIMEOUT:{code:408,message:"Timeout"},CONFLICT:{code:409,message:"Conflict"},PRECONDITION_FAILED:{code:412,message:"Precondition Failed"},PAYLOAD_TOO_LARGE:{code:413,message:"Payload Too Large"},UNSUPPORTED_MEDIA_TYPE:{code:415,message:"Unsupported Media Type"},UNPROCESSABLE_CONTENT:{code:422,message:"Unprocessable Content"},TOO_MANY_REQUESTS:{code:429,message:"Too Many Requests"},CLIENT_CLOSED_REQUEST:{code:499,message:"Client Closed Request"},INTERNAL_SERVER_ERROR:{code:500,message:"Internal Server Error"},NOT_IMPLEMENTED:{code:501,message:"Not Implemented"},BAD_GATEWAY:{code:502,message:"Bad Gateway"},SERVICE_UNAVAILABLE:{code:503,message:"Service Unavailable"},GATEWAY_TIMEOUT:{code:504,message:"Gateway Timeout"}},R=class extends Error{constructor(e,t){super(e),this.code=e,this.message=t||T[e].message;}},g=(r,e)=>{throw new R(r,e)},x=r=>r instanceof R?new Response(JSON.stringify({error:{message:r.message}}),{status:T[r.code].code,statusText:r.message}):new Response(JSON.stringify(r,Object.getOwnPropertyNames(r)),{status:r.code||500,statusText:r.message||"Internal Server Error"});var E={stringify:r=>{if(r instanceof URL)return r.toString()},parse:r=>new URL(r)},O=r=>devalue.stringify(r,{URL:E.stringify}),k=r=>devalue.parse(r,{URL:E.parse}),q=(r,e=new FormData)=>{let t=devalue.stringify(r,{File:n=>{if(n instanceof File)return e.append(n.name,n),n.name},URL:E.stringify});return e.set("value",t),e},I=r=>{let e=r.get("value");return devalue.parse(e,{File:n=>r.get(n),URL:E.parse})};var A=r=>{try{return typeof r!="string"?r:JSON.parse(r)}catch{return r}};var y=(r,e)=>{if(r!==void 0){let t=r.safeParse?.(e)||r._parse?.(e),n=t?.error?.issues||t.issues;if(n)throw new Error(JSON.stringify(n));return t.data||t.output}},H=async(r,e)=>{let t={};if(r)for(let n of r)Object.assign(t,await n(e));return t};var S=async(r,e)=>{let t=r.request,n=r.url,o=r.request.method,s=r.request.headers.get("x-flarepc-client")==="true",a=JSON.stringify({error:{message:"Not Found"}}),d={"Content-Type":"application/json"},i=o==="GET"?JSON.parse(decodeURIComponent(new URLSearchParams(n.search).get("input")||"{}")):s?I(await t.formData()):await t.json();return e&&"call"in e&&(a=await e.call(r,y(e.schema,i)),a?.constructor.name==="ReadableStream"?d["Content-Type"]="text/event-stream":a&&a instanceof File?d={"Content-Type":a.type,"Content-Disposition":"attachment; filename="+a.name}:(s?delete d["Content-Type"]:d={"Content-Type":"application/json"},a=s?q(a):JSON.stringify(a))),new Response(a,{headers:d,status:200})};var h=(r,e)=>{let t=r;return e.forEach(n=>{t=t?.[n]?t?.[n]:void 0;}),t||null},C=async(r,e,t,n)=>{let o=new URL(r.url),s=o.pathname.split("/").filter(Boolean),a=r.headers.get("x-flarepc-object-id")||null,d=r.headers.get("x-flarepc-object-name")||null,i=r.method;return i!=="POST"&&s.push(i.toLocaleLowerCase()),a&&d&&(s=s.slice(1)),Object.assign({},{path:s,locals:typeof e=="function"?await e(r,t,n):e,objectId:a,objectName:d,request:r,url:o,caches,cookies:D(r)})},w=(r,e,t)=>Object.assign({},t,r,e),X=({router:r,before:e=[],after:t=[],locals:n={},cors:o,catch:s,objects:a})=>({async fetch(d,i,l){let p=await C(d,n,i,l),c=w(p,i,l),u;e:try{for(let m of e.concat(o?.preflight||[])||[])if(u=await m(c)??u,u)break e;if(c.objectName?a?.[c.objectName]:null){let m=i[c.objectName].idFromName(c.objectId);u=await i[c.objectName].get(m).handleRpc(d,n);}else {let m=h(r,c.path);m?u=await S(c,m):g("NOT_FOUND");}}catch(f){console.log({error:f}),s?.(f),u=x(f);}for(let f of t.concat(o?.corsify||[])||[])u=await f(u,c)??u;return u}});var L=(r,e)=>t=>new b(r,e,t),j=(...r)=>({handle:e=>L(r,void 0)(e),input:e=>({handle:t=>L(r,e)(t)})}),re=()=>(...r)=>j(...r),b=class{constructor(e,t,n){this.call=async(e,t,n)=>this.handleFunction({event:e,input:t,ctx:await H(this.middlewares,e),object:n});this.middlewares=e,this.schema=t,this.handleFunction=n;}};var P=class{constructor(e,t,n){this.state="CLOSED";this.abortController=new AbortController;this.send=(e,t)=>{console.log(e,t);};this.ws=new WebSocket(t,Object.entries(e.headers||{}).reduce((o,[s,a])=>(o.push(`${s}: ${a}`),o),[])),this.state="CONNECTING",this.ws.addEventListener("open",()=>{this.ws.send(JSON.stringify({type:"connect",data:e.participant})),n?.(this),e.onOpen?.();},{signal:this.abortController.signal}),this.ws.addEventListener("close",()=>{this.state="CLOSED",e.onClose?.();},{signal:this.abortController.signal}),this.ws.addEventListener("message",o=>{let{type:s,data:a}=k(o.data);s==="ping"?this.ws.send("pong"):s==="connect"?this.state:e.messages[s]?.({data:a,ctx:a});},{signal:this.abortController.signal}),this.participant=e.participant;}destroy(){this.ws.close(),this.abortController.abort();}},oe=(r,e)=>new Promise((t,n)=>{new P(r,e,t);});var fe=()=>class extends v{constructor(r,e,t,n,o){super(r,e,t,n,o),this.ctx=r,this.env=e;}},v=class extends cloudflare_workers.DurableObject{constructor(t,n,o,s,a){super(t,n);this.onMessage=t=>{"receive"in this&&typeof this.receive=="function"&&this.receive(t.type,t.data);};this.router=o,s&&a&&(this.topics={in:s,out:a}),this.state=t,this.storage=t.storage,this.env=n,this.sessions=new Map,this.lastTimestamp=0,this.currentlyConnectedWebSockets=0;}async fetch(t){if(t.url==="/connect"){let n=new WebSocketPair,[o,s]=Object.values(n);return s.accept(),this.currentlyConnectedWebSockets+=1,this.ws=s,s.addEventListener("message",a=>{a.type==="ping"?s.send("pong"):this.onMessage(a);}),s.addEventListener("open",()=>{}),s.addEventListener("close",a=>{this.currentlyConnectedWebSockets=Math.min(this.currentlyConnectedWebSockets-1,0),this.currentlyConnectedWebSockets===0&&s.close(a.code,"Durable Object is closing WebSocket");},{signal:new AbortController().signal}),s.send("Hello from client"),new Response(null,{status:101,webSocket:o})}else return new Response(null,{status:101})}async handleRpc(t,n){try{let o=await C(t,n,this.env,{}),s=w(o,this.env,{}),a=h(this.router,s.path);if(!a)g("NOT_FOUND");else return S(s,a)}catch(o){return x(o)}}getRouter(){return this.router}},me=(r,e)=>async(t,n,o)=>{let s=h(r,String(n).split("/"));if(s)return s.call(t,o,e);throw g("NOT_FOUND")},Re=(r,e)=>async(t,n)=>{let o=h(r,String(t).split("/")),s=await y(o?.schema,n),a=await o?.call(e.requestEvent,s,e);e.ws?.send(O({type:t,data:s,ctx:a}));},he=(r,e)=>async(t,n)=>{try{let o=h(r,String(t).split("/")),s=await y(o?.schema,n);await o?.call(e.requestEvent,s,e);}catch(o){o instanceof R?e.ws?.send(O({type:"error",topic:t,error:{message:o.message,code:o.code}})):e.ws?.send(O({type:"error",topic:t,error:JSON.stringify(o,Object.getOwnPropertyNames(o))}));}};var xe=(r={})=>{let{origin:e="*",credentials:t=!1,allowMethods:n="*",allowHeaders:o="*",exposeHeaders:s="*",maxAge:a}=r,d={"access-control-allow-headers":o?.join?.(",")??o,"access-control-expose-headers":s?.join?.(",")??s,"access-control-allow-methods":n?.join?.(",")??n,"access-control-max-age":a,"access-control-allow-credentials":t},i=c=>{let u=c?.headers.get("origin");return e===!0?u:e instanceof RegExp?e.test(u)?u:void 0:Array.isArray(e)?e.includes(u)?u:void 0:e instanceof Function?e(u):e=="*"&&t?u:e};return {corsify:(c,u)=>{c.headers.has("access-control-allow-origin")||(c.headers.set("access-control-allow-origin",i(u.request)),Object.entries(d).forEach(([f,m])=>{c.headers.set(f,m);}));},preflight:c=>{if(c.request.method=="OPTIONS")return new Response(null,{status:204,headers:Object.entries({"access-control-allow-origin":i(c.request),...d}).filter(u=>u[1])})}}};var Se=(r,e)=>{let t=r.getReader(),n=[],o=!0,s=new TextDecoder;return [new ReadableStream({start(d){e?.onStart?.();let i=async()=>{let{done:l,value:p}=await t.read();if(l){d.close(),e?.onEnd?.(n);return}else if(p){let c=A(s.decode(p));n.push(c),e?.onChunk?.({chunk:c,first:o}),o=!1;}d.enqueue(p),i();};i();}}),{"Content-Type":"text/event-stream"}]};
exports.DurableRouter = L;
exports.DurableRouter = v;
exports.FLARERROR = R;
exports.Handler = b;
exports.WebSocketClient = P;
exports.cors = ge;
exports.createCookies = v;
exports.createHandler = fe;
exports.cors = xe;
exports.createCookies = D;
exports.createDurableRouter = fe;
exports.createHandler = me;
exports.createPartialRequestEvent = C;
exports.createReceiver = Re;
exports.createReceiver = he;
exports.createRequestEvent = w;
exports.createSender = me;
exports.createSender = Re;
exports.createServer = X;
exports.createWebSocketConnection = oe;
exports.deform = q;
exports.deform = I;
exports.durableProcedure = re;
exports.error = g;
exports.form = k;
exports.form = q;
exports.getHandler = h;
exports.handleError = O;
exports.handleError = x;
exports.handleRequest = S;
exports.procedure = j;
exports.socketify = x;
exports.socketiparse = N;
exports.stream = Ee;
exports.socketify = O;
exports.socketiparse = k;
exports.stream = Se;
//# sourceMappingURL=index.js.map
//# sourceMappingURL=index.js.map
{
"name": "flarepc",
"version": "0.0.22",
"version": "0.0.23",
"private": false,

@@ -5,0 +5,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc