palbase 0.75.0 → 0.76.0
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/dist/ai/index.js +2 -2
- package/dist/ai-sdk/index.js +2 -2
- package/dist/backend/engine.js +2 -2
- package/dist/backend/env.js +1 -1
- package/dist/backend/index.js +3 -3
- package/dist/backend/stack.js +1 -1
- package/dist/backend/test.js +2 -2
- package/dist/chunks/{ZWASHVNO.js → 2NEPN2ZZ.js} +2 -2
- package/dist/chunks/{P6LK5BD6.js → 33XOVYAU.js} +2 -2
- package/dist/chunks/{2SVWIAAD.js → 3CN6HGTW.js} +1 -1
- package/dist/chunks/{HT6TR6AZ.js → 3VGWTVKI.js} +2 -2
- package/dist/chunks/{MT22R56P.js → 5RNXCTOO.js} +2 -2
- package/dist/chunks/{FJVUDV4I.js → 5YJZAPY2.js} +2 -2
- package/dist/chunks/{UPJGT3BN.js → A3I7H7QN.js} +1 -1
- package/dist/chunks/{XZSXLA3N.js → ALT62XIG.js} +2 -2
- package/dist/chunks/{KWVOOFCB.js → BRDO3ZPT.js} +1 -1
- package/dist/chunks/{7BSFT4SH.js → D6NOE76D.js} +1 -1
- package/dist/chunks/{EFDYHDIB.js → DKYFIOWM.js} +1 -1
- package/dist/chunks/{5NZNKECX.js → EXLA3A7O.js} +2 -2
- package/dist/chunks/{XUEBLD7V.js → ISMWEEGW.js} +1 -1
- package/dist/chunks/{RBZI2C7M.js → KEGVHELA.js} +1 -1
- package/dist/chunks/{7R5TMAGP.js → MKVIRNSJ.js} +2 -2
- package/dist/chunks/{POURMU7G.js → PGQNRJ2C.js} +2 -2
- package/dist/chunks/{GSY2E764.js → Q4UWBIJ6.js} +2 -2
- package/dist/chunks/{GMCROKBB.js → SVWF7ABJ.js} +2 -2
- package/dist/chunks/{SPMFD3LH.js → TGQGGUE6.js} +2 -2
- package/dist/chunks/{LGXI36R6.js → TUK6NH2Q.js} +2 -2
- package/dist/chunks/{UKONQ2R4.js → UHN63FGH.js} +7 -7
- package/dist/chunks/{G37YLKYL.js → UOW74IHY.js} +2 -2
- package/dist/chunks/{3GR5ZPYK.js → YRYPXVAJ.js} +2 -2
- package/dist/chunks/{YEZCBT5I.js → ZCMCYI2D.js} +2 -2
- package/dist/cli.js +2 -2
- package/dist/cloud/index.js +2 -2
- package/dist/refuse/ai-sdk.js +1 -1
- package/dist/refuse/ai.js +1 -1
- package/dist/refuse/backend.js +1 -1
- package/dist/refuse/cloud.js +1 -1
- package/dist/refuse/server.js +1 -1
- package/dist/server/index.js +2 -2
- package/dist/server/testing.js +2 -2
- package/dist/web/index.js +2 -2
- package/dist/web/message.js +2 -2
- package/dist/web/palbe.js +2 -2
- package/dist/web/payments-ui.js +2 -2
- package/dist/web/paywall.js +2 -2
- package/dist/web/push-sw.js +1 -1
- package/dist/web/ssr.js +2 -2
- package/dist/web/vite.js +2 -2
- package/package.json +2 -2
- package/types/backend/src/gateways.d.ts +9 -0
package/dist/web/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! palbase 0.
|
|
2
|
-
import{A as he,B as ge,C as we,D as Ce,E as Se,F as Re,G as be,H as ve,a as $,b as B,c as D,e as q,f as F,g as j,h as G,i as U,j as H,k as N,l as W,m as K,n as J,o as X,p as Z,q as ae,r as ie,s as pe,t as ce,u as ye,v as de,w as le,x as ue,y as me,z as fe}from"../chunks/
|
|
1
|
+
/*! palbase 0.76.0 — Palbase SDK License (see LICENSE) */
|
|
2
|
+
import{A as he,B as ge,C as we,D as Ce,E as Se,F as Re,G as be,H as ve,a as $,b as B,c as D,e as q,f as F,g as j,h as G,i as U,j as H,k as N,l as W,m as K,n as J,o as X,p as Z,q as ae,r as ie,s as pe,t as ce,u as ye,v as de,w as le,x as ue,y as me,z as fe}from"../chunks/33XOVYAU.js";import{a as ee,b as te,c as ne,d as re,e as oe,f as se}from"../chunks/ZCMCYI2D.js";import{a as Q,b as _,f as z}from"../chunks/ALT62XIG.js";import{c as Y}from"../chunks/2NEPN2ZZ.js";import"../chunks/5YJZAPY2.js";import"../chunks/TUK6NH2Q.js";import"../chunks/DKYFIOWM.js";import"../chunks/3VGWTVKI.js";import{b,c as k,d as E,f as T,g as x,j as I,k as A,l as M,m as v,o as P}from"../chunks/A3I7H7QN.js";import"../chunks/SVWF7ABJ.js";import{b as V}from"../chunks/UOW74IHY.js";import"../chunks/ISMWEEGW.js";import"../chunks/D6NOE76D.js";var Pe="oai-events";async function Oe(e){if(typeof e?.start!="function")throw new TypeError("connectVoice: start(sdp) is the round trip to the app's backend, which starts the voice (chats.voice.start) and answers { id, sdp }");let r=e.rtc??Te(),t=e.signal;t?.throwIfAborted();let l=e.audio??xe(),m=e.microphone===void 0,c=e.microphone??await r.getUserMedia({audio:!0});if(t?.aborted){if(m)for(let n of c.getTracks())n.stop();throw t.reason}let o=new r.RTCPeerConnection,s=!1,u=()=>{if(!s){if(s=!0,f.close(),o.close(),m)for(let n of c.getTracks())n.stop();l.srcObject!==null&&(l.srcObject=null)}};o.addEventListener("track",n=>{l.srcObject=n.streams[0]??new MediaStream([n.track]),l.play?.()?.catch?.(()=>{})}),o.addEventListener("connectionstatechange",()=>e.onState?.(o.connectionState));for(let n of c.getAudioTracks())o.addTrack(n,c);let f=o.createDataChannel(Pe);f.addEventListener("message",n=>{let p=Ee(n.data);p!==void 0&&e.onError?.(p)});let y=()=>u();t?.addEventListener("abort",y,{once:!0});try{await o.setLocalDescription(await o.createOffer()),t?.throwIfAborted(),await ke(o,e.iceTimeoutMs??1e4,t);let n=o.localDescription?.sdp;if(!n)throw new Error("connectVoice: the peer connection made no offer");let p=await e.start(n);t?.throwIfAborted();let h=typeof p?.sdp=="string"&&p.sdp!==""?p.sdp:p?.transport?.sdp;if(typeof p?.id!="string"||p.id===""||typeof h!="string"||h==="")throw new TypeError("connectVoice: start answered no voice \u2014 it is { id, sdp } or { id, transport: { sdp } }, chats.voice.start's answer as the backend got it");return await o.setRemoteDescription({type:"answer",sdp:h}),t?.removeEventListener("abort",y),{id:p.id,peer:o,audio:l,microphone:c,get muted(){return c.getAudioTracks().every(w=>!w.enabled)},mute(w){for(let C of c.getAudioTracks())C.enabled=!w},close:u}}catch(n){throw t?.removeEventListener("abort",y),u(),t?.aborted?t.reason:n}}function ke(e,r,t){return e.iceGatheringState==="complete"?Promise.resolve():t?.aborted?Promise.reject(t.reason):new Promise((l,m)=>{let c=()=>{clearTimeout(u),e.removeEventListener("icegatheringstatechange",o),t?.removeEventListener("abort",s)},o=()=>{e.iceGatheringState==="complete"&&(c(),l())},s=()=>{c(),m(t?.reason)},u=setTimeout(()=>{c(),m(new Error(`connectVoice: the network candidates were not gathered in ${r} ms`))},r);e.addEventListener("icegatheringstatechange",o),t?.addEventListener("abort",s,{once:!0})})}function Ee(e){if(typeof e=="string")try{let r=JSON.parse(e);return r.type!=="error"?void 0:typeof r.error?.message=="string"?r.error.message:typeof r.error?.code=="string"?r.error.code:"the voice failed"}catch{return}}function Te(){let e=globalThis;if(typeof e.RTCPeerConnection!="function"||typeof e.navigator?.mediaDevices?.getUserMedia!="function")throw new TypeError("connectVoice: this runtime has no WebRTC (RTCPeerConnection, navigator.mediaDevices): a chat's voice is a browser's");let r=e.navigator.mediaDevices;return{RTCPeerConnection:e.RTCPeerConnection,getUserMedia:t=>r.getUserMedia(t)}}function xe(){let e=globalThis.document;if(!e)throw new TypeError("connectVoice: give audio \u2014 the element the voice plays in \u2014 where there is no document");let r=e.createElement("audio");return r.autoplay=!0,r}var i=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0;function Ie(e,r,t){let l=i(i(i(e)?.components)?.schemas)??{},m=(y,n)=>{let p=new Set,h=(C,g,d)=>{let a=i(C);if(!a)return;if(typeof a.$ref=="string"){if(d.has(a.$ref)||!a.$ref.startsWith("#/components/schemas/"))return;h(l[a.$ref.slice(21)],g,new Set(d).add(a.$ref));return}if(a[b]===!0){p.add(g);return}for(let S of["anyOf","oneOf","allOf"]){let R=a[S];if(Array.isArray(R))for(let L of R)h(L,g,d)}let O=i(a.properties);if(O)for(let[S,R]of Object.entries(O))h(R,`${g}/${v(S)}`,d);i(a.items)&&h(a.items,`${g}/*`,d);for(let S of["additionalProperties","patternProperties","prefixItems"])if(a[S]!==void 0&&w(a[S],new Set(d)))throw new Error(`${t}: an encrypted field is a named property \u2014 not every key of a record, nor a tuple's place`)},w=(C,g)=>{if(Array.isArray(C))return C.some(a=>w(a,g));let d=i(C);return d?d[b]===!0?!0:typeof d.$ref=="string"&&!g.has(d.$ref)&&d.$ref.startsWith("#/components/schemas/")?(g.add(d.$ref),w(l[d.$ref.slice(21)],g)):Object.values(d).some(a=>typeof a=="object"&&a!==null&&w(a,g)):!1};return h(y,n,new Set),[...p]},c=y=>i(i(i(y)?.["application/json"])?.schema),o=[];o.push(...m(c(i(r.requestBody)?.content),"/body"));for(let y of Array.isArray(r.parameters)?r.parameters:[]){let n=i(y);if(!n)continue;let p=m(n.schema,`/query/${v(String(n.name))}`);if(p.length!==0){if(n.in!=="query")throw new Error(`${t}: ${String(n.in)} parameter ${String(n.name)} is marked encrypted \u2014 a body's or a query's field is`);if(p.some(h=>h.split("/").length!==3))throw new Error(`${t}: an encrypted query field is one of the query's own names`);o.push(...p)}}let s=i(r.responses)??{},u=Object.keys(s).filter(y=>/^2\d\d$/.test(y)).sort((y,n)=>y==="200"?-1:n==="200"?1:y.localeCompare(n)),f=u.length>0?m(c(i(s[u[0]])?.content),"/response"):[];if(o.length+f.length!==0){if(r["x-palbase-sse"]!==void 0&&f.length>0)throw new Error(`${t}: a streamed answer carries no encrypted field`);if(r["x-palbase-upload"]!==void 0)throw new Error(`${t}: an upload goes through storage, which seals nothing \u2014 it carries no encrypted field`);return{request:o,response:f}}}async function Ae(e){let r=`${e.method.toUpperCase()} ${e.path}`,t=i(i(i(i(e.contract)?.paths)?.[e.path])?.[e.method.toLowerCase()]),l=t?Ie(e.contract,t,r):void 0;if(!l)return{body:e.body,query:e.query,open:async s=>s};let{key:m,header:c}=await x(e.key.kid,E(e.key.publicKey),T(e.projectId,e.method,e.path,e.params??[])),o=(s,u)=>s==null?s:P(s,u,l.request,(f,y)=>I(m,f,y));return{header:c,body:await o(e.body,"/body"),query:await o(e.query,"/query"),open:s=>s===void 0?Promise.resolve(s):P(s,"/response",l.response,async(u,f)=>{if(!A(f))throw new k("unopenable",`${r}: ${u} came plain where the contract says it is encrypted`);return M(m,u,f)})}}export{G as Analytics,Q as BackendError,ae as COMMERCE_DISCOVERY_EVENTS,Re as CallPlace,Ce as CallSession,Se as Calls,ce as Campaigns,q as Channel,be as ClientTemplates,pe as Commerce,U as Consent,ue as ConversationList,fe as ConversationView,me as DeletedGroupList,ye as Flags,z as GatewayError,X as Iap,W as InApp,H as Inbox,j as Installation,le as Messaging,J as Notify,V as PalbaseError,oe as Payments,we as PlaceBusyError,F as RealtimeSocket,N as SESSION_START,ge as ScheduledList,ie as SellerPortal,$ as SessionChangedError,ee as TERMINAL_INTENT_STATUSES,he as ThreadView,K as WebPush,Oe as connectVoice,ve as createClient,re as declineMessage,Ae as encryptedCall,de as indexedDBKeyValue,_ as isBackendError,te as isTerminalIntentStatus,D as localStore,B as memoryStore,se as mountEmbedFrame,ne as parseCallbackMessage,Z as redemptionToken,Y as sessionSummary};
|
package/dist/web/message.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! palbase 0.
|
|
2
|
-
import{a as i}from"../chunks/
|
|
1
|
+
/*! palbase 0.76.0 — Palbase SDK License (see LICENSE) */
|
|
2
|
+
import{a as i}from"../chunks/TUK6NH2Q.js";import{a as e,b as s,c as t,d as p,e as o,f as a,h as r,j as n,k as y,p as M,q as l,t as g}from"../chunks/DKYFIOWM.js";import"../chunks/D6NOE76D.js";export{n as MESSAGE_COMPONENTS,a as MESSAGE_ICONS,r as MESSAGE_SCHEMA,s as assetId,y as countdownValues,e as fontFamily,o as htmlDocument,t as prepareAssets,i as presentMessage,g as renderMessage,M as resolveMessage,l as resolveMessageWithPaths,p as unzip};
|
package/dist/web/palbe.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! palbase 0.
|
|
2
|
-
import{c as e,d as r,i as t}from"../chunks/
|
|
1
|
+
/*! palbase 0.76.0 — Palbase SDK License (see LICENSE) */
|
|
2
|
+
import{c as e,d as r,i as t}from"../chunks/ALT62XIG.js";import"../chunks/2NEPN2ZZ.js";import"../chunks/A3I7H7QN.js";import"../chunks/SVWF7ABJ.js";import"../chunks/UOW74IHY.js";import"../chunks/ISMWEEGW.js";import"../chunks/D6NOE76D.js";export{e as RESERVED_CLIENT_NAMES,t as __registerBackend,r as isClientName};
|
package/dist/web/payments-ui.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! palbase 0.
|
|
2
|
-
import{b as ae,d as re,f as X}from"../chunks/
|
|
1
|
+
/*! palbase 0.76.0 — Palbase SDK License (see LICENSE) */
|
|
2
|
+
import{b as ae,d as re,f as X}from"../chunks/ZCMCYI2D.js";import"../chunks/3VGWTVKI.js";import"../chunks/UOW74IHY.js";import"../chunks/ISMWEEGW.js";import"../chunks/D6NOE76D.js";var le='-apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif';function ce(s){if(s==="dark"||s==="light")return s;try{let r=globalThis.matchMedia;return r?.("(prefers-color-scheme: dark)").matches?"dark":"light"}catch{return"light"}}function j(s){return s?.locale??globalThis.navigator?.language??"en-US"}function K(s){try{return new Intl.NumberFormat("en",{style:"currency",currency:s}).resolvedOptions().maximumFractionDigits??2}catch{return 2}}function O(s,r,e="en-US"){let i=K(r),t=s/10**i;try{return new Intl.NumberFormat(e,{style:"currency",currency:r}).format(t)}catch{return`${t.toFixed(i)} ${r.toUpperCase()}`}}function G(s){switch((s??"").toLowerCase()){case"visa":return"Visa";case"mastercard":return"Mastercard";case"troy":return"Troy";case"amex":return"Amex";default:return s?s.toUpperCase():"Card"}}function Q(s,r){let i=ce(r?.theme)==="dark",t=r?.primaryColor??(i?"#3B82F6":"#111827"),a=r?.surfaceColor??(i?"#18181B":"#FFFFFF"),p=r?.textColor??(i?"#F4F4F5":"#111827"),f=r?.borderRadius??"12px",l=r?.fontFamily??le;s.style.setProperty("--pb-surface",a),s.style.setProperty("--pb-surface-alt",i?"#27272A":"#F4F4F5"),s.style.setProperty("--pb-text",p),s.style.setProperty("--pb-muted",i?"#A1A1AA":"#52525B"),s.style.setProperty("--pb-border",i?"#3F3F46":"#E4E4E7"),s.style.setProperty("--pb-primary",t),s.style.setProperty("--pb-on-primary","#FFFFFF"),s.style.setProperty("--pb-danger",i?"#F87171":"#DC2626"),s.style.setProperty("--pb-danger-bg",i?"rgba(220,38,38,0.16)":"#FEF2F2"),s.style.setProperty("--pb-success",i?"#34D399":"#059669"),s.style.setProperty("--pb-success-bg",i?"rgba(5,150,105,0.16)":"#ECFDF5"),s.style.setProperty("--pb-radius",f),s.style.setProperty("--pb-font",l)}var de=`
|
|
3
3
|
:host {
|
|
4
4
|
display: block;
|
|
5
5
|
font-family: var(--pb-font);
|
package/dist/web/paywall.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! palbase 0.
|
|
2
|
-
import{a as f,b as d,c as m,d as u,e as A,f as c,g as R}from"../chunks/
|
|
1
|
+
/*! palbase 0.76.0 — Palbase SDK License (see LICENSE) */
|
|
2
|
+
import{a as f,b as d,c as m,d as u,e as A,f as c,g as R}from"../chunks/5YJZAPY2.js";import{a as e,b as a,c as t,d as l,e as r,f as o,g as p,i as y,k as s,l as P,n,o as i,s as w}from"../chunks/DKYFIOWM.js";import"../chunks/UOW74IHY.js";import"../chunks/ISMWEEGW.js";import"../chunks/D6NOE76D.js";export{y as PAYWALL_COMPONENTS,o as PAYWALL_ICONS,p as PAYWALL_SCHEMA,c as Paywall,a as assetId,f as attributesHeader,s as countdownValues,R as defaultPaywall,e as fontFamily,u as formatPeriod,m as formatPrice,r as htmlDocument,A as packageValues,P as packagesOf,d as parseDuration,t as prepareAssets,w as renderPaywall,n as resolvePaywall,i as resolvePaywallWithPaths,l as unzip};
|
package/dist/web/push-sw.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! palbase 0.
|
|
1
|
+
/*! palbase 0.76.0 — Palbase SDK License (see LICENSE) */
|
|
2
2
|
"use strict";(()=>{function g(t,l){if(t)try{let o=new URL(t,l);if(o.protocol==="https:"||o.protocol==="http:"&&(o.hostname==="localhost"||o.hostname==="127.0.0.1"))return o.href}catch{}}function w(t){let l=new URL(t.location.href).searchParams,o=l.get("url")??"",p=l.get("key")??"",c=(e,n)=>!e||!o?Promise.resolve():t.fetch(`${o.replace(/\/$/,"")}/notify/receipts`,{method:"POST",headers:{"content-type":"application/json",apikey:p},body:JSON.stringify({receipts:[{receipt:e,status:n}]}),keepalive:!0}).catch(()=>{}),f=async(e,n)=>{for(let s of await t.clients.matchAll({type:"window",includeUncontrolled:!0}))s.postMessage({type:"palbase.push",event:e,url:n.url,data:n.data})};t.addEventListener("push",(e=>{let n={};try{n=e.data?.json()??{}}catch{}let s={url:n.url,receipt:n.receipt,data:n.data},a=n.data?.type==="messaging.message"||n.data?.pb_call==="incoming",u=async()=>a&&(await t.clients.matchAll({type:"window",includeUncontrolled:!0})).some(i=>i.focused===!0),r=async()=>{let i=n.data?.pb_call==="missed"?n.data.call_id:void 0;if(i)for(let d of await t.registration.getNotifications?.({tag:i})??[])d.close()};e.waitUntil(Promise.all([u(),r().catch(()=>{})]).then(([i])=>i?void 0:t.registration.showNotification(n.title??"",{body:n.body,image:n.image,tag:n.tag,data:s})).then(()=>Promise.all([c(n.receipt,"delivered"),f("received",s)])))})),t.addEventListener("notificationclick",(e=>{e.notification.close();let n=e.notification.data??{},s=n.data?.pb_call!==void 0,a=g(n.url,t.location.origin)??(s?g(t.registration.scope??"/",t.location.origin):void 0),u=async()=>{if(!a)return;let r=await t.clients.matchAll({type:"window",includeUncontrolled:!0}),i=r.find(d=>d.url===a)??(s&&!n.url?r.find(d=>d.focused)??r[0]:void 0);i?await i.focus():await t.clients.openWindow(a)};e.waitUntil(Promise.all([c(n.receipt,"opened"),u(),f("opened",n)]))})),t.addEventListener("notificationclose",(e=>{e.waitUntil(c(e.notification.data?.receipt,"dismissed"))}))}typeof self<"u"&&typeof self.registration=="object"&&!("document"in self)&&w(self);})();
|
package/dist/web/ssr.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! palbase 0.
|
|
2
|
-
import{H as g,d as C}from"../chunks/
|
|
1
|
+
/*! palbase 0.76.0 — Palbase SDK License (see LICENSE) */
|
|
2
|
+
import{H as g,d as C}from"../chunks/33XOVYAU.js";import"../chunks/ZCMCYI2D.js";import"../chunks/ALT62XIG.js";import"../chunks/2NEPN2ZZ.js";import"../chunks/5YJZAPY2.js";import"../chunks/TUK6NH2Q.js";import"../chunks/DKYFIOWM.js";import"../chunks/3VGWTVKI.js";import"../chunks/A3I7H7QN.js";import"../chunks/SVWF7ABJ.js";import"../chunks/UOW74IHY.js";import"../chunks/ISMWEEGW.js";import"../chunks/D6NOE76D.js";var $=Object.freeze({"Cache-Control":"private, no-cache, no-store, must-revalidate, max-age=0",Expires:"0",Pragma:"no-cache"}),b={path:"/",sameSite:"lax",secure:!0,httpOnly:!1,maxAge:400*24*60*60},h=3180,v=5*6e4;function w(e,t={}){let o=/^pb_([a-z0-9]+)_c/.exec(e)?.[1];if(o===void 0)throw new TypeError("publishableKey is the project publishable key (pb_<ref>_c\u2026)");let s={...b,...t};return`${s.secure===!0&&!s.domain&&(s.path??"/")==="/"?"__Host-":""}pb-${o}-session`}var _=e=>{let t=new TextEncoder().encode(JSON.stringify(e)),o="";for(let s of t)o+=String.fromCharCode(s);return btoa(o).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},T=e=>{try{let t=atob(e.replace(/-/g,"+").replace(/_/g,"/")),o=JSON.parse(new TextDecoder().decode(Uint8Array.from(t,s=>s.charCodeAt(0))));return typeof o.accessToken!="string"||typeof o.refreshToken!="string"||typeof o.expiresAt!="number"||typeof o.userId!="string"?null:o}catch{return null}},f="__Host-",x=!1;function A(e,t,o={},s=!1){let r={...b,...o},d=async()=>new Map((await t.getAll()).map(n=>[n.name,n.value])),m=n=>a=>a===n||a.startsWith(`${n}.`)&&/^\d+$/.test(a.slice(n.length+1)),S=m(e),k=e.startsWith(f)?e.slice(f.length):f+e,y=m(k),O=async n=>{if(!t.setAll)return;let a=n===null?[]:n.length<=h?[[e,n]]:Array.from({length:Math.ceil(n.length/h)},(i,u)=>[`${e}.${u}`,n.slice(u*h,(u+1)*h)]),l=new Set(a.map(([i])=>i)),c=a.map(([i,u])=>({name:i,value:u,options:r})),p=await d();for(let i of p.keys())S(i)&&!l.has(i)&&c.push({name:i,value:"",options:{...r,maxAge:0}});if(e.startsWith(f))for(let i of p.keys())y(i)&&c.push({name:i,value:"",options:{...r,maxAge:0}});c.length>0&&await t.setAll(c,{...$})};return{async load(){let n=await d(),a=[...n.keys()];!x&&!a.some(S)&&a.some(y)&&(x=!0,console.warn(`palbase: the request holds a session cookie named ${k}, and this client reads ${e}: no one is signed in here. The browser's client and the server's name it from the same cookieOptions \u2014 on http (localhost) the server's needs cookieOptions: { secure: false }.`));let l=n.get(e);if(l===void 0){let c="";for(let p=0;n.has(`${e}.${p}`);p++)c+=n.get(`${e}.${p}`);l=c}return l?T(l):null},save:n=>O(_(n)),clear:()=>O(null),shared:s}}function N(e){let{cookies:t,cookieOptions:o,...s}=e,r=e.refresh??(t.setAll?"before":"never");return g({...s,refresh:r,storage:A(w(e.publishableKey,o),t,o)})}function E(){let e=()=>{let t=globalThis.document;if(!t)throw new Error("documentCookies: there is no document here \u2014 a server gives its request's cookies to createServerClient");return t};return{getAll:()=>e().cookie.split(";").map(t=>t.trim()).filter(t=>t.includes("=")).map(t=>{let o=t.indexOf("=");return{name:t.slice(0,o),value:t.slice(o+1)}}),setAll(t){for(let o of t){let s=o.options,r=[`Path=${s.path??"/"}`,s.domain?`Domain=${s.domain}`:"",s.maxAge!==void 0?`Max-Age=${s.maxAge}`:"",s.expires?`Expires=${s.expires.toUTCString()}`:"",s.sameSite?`SameSite=${s.sameSite.charAt(0).toUpperCase()}${s.sameSite.slice(1)}`:"",s.secure?"Secure":""].filter(Boolean);e().cookie=[`${o.name}=${o.value}`,...r].join("; ")}}}}function R(e){let{cookieOptions:t,...o}=e,r={secure:globalThis.location?.protocol==="https:",...t};return g({...o,storage:A(w(e.publishableKey,r),E(),r,!0)})}async function U(e){let t=await e.auth.currentSession();if(!t||(t.expiresAt-Date.now()<=C(t.accessToken,v)&&await e.auth.refreshSession().catch(()=>{}),!await e.auth.currentSession()))return null;try{return(await e.auth.api.verifyTokenUser()).data}catch(o){if(o.status===401)return null;throw o}}export{$ as NO_STORE_HEADERS,b as SESSION_COOKIE_OPTIONS,A as cookieSessionStore,R as createBrowserClient,N as createServerClient,E as documentCookies,U as keepSession,w as sessionCookieName};
|
package/dist/web/vite.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! palbase 0.
|
|
2
|
-
import"../chunks/
|
|
1
|
+
/*! palbase 0.76.0 — Palbase SDK License (see LICENSE) */
|
|
2
|
+
import"../chunks/D6NOE76D.js";import{execFile as R}from"node:child_process";import{existsSync as A,mkdtempSync as C,readFileSync as W,rmSync as J,writeFileSync as N}from"node:fs";import{createRequire as I}from"node:module";import{tmpdir as T}from"node:os";import{dirname as v,join as f,relative as S,resolve as b,sep as k}from"node:path";var E=/\.(?:ts|js|mts|mjs)$/;function x(n){return n?Array.isArray(n)?n:Object.entries(n).map(([t,e])=>({find:t,replacement:e})):[]}function V(n,t){for(let{find:e,replacement:s}of t)if(typeof e=="string"){if(n===e)return s;if(n.startsWith(e)&&(e.endsWith("/")||n[e.length]==="/"))return`${s}${n.slice(e.length)}`}else if(e instanceof RegExp&&e.test(n))return n.replace(e,s);return null}function U(n){if(!/^[a-z][a-z0-9-]*$/.test(n.app))throw new TypeError(`palbase({ app }): ${JSON.stringify(n.app)} is an app's slug (palbase apps:list)`);let t=process.cwd(),e="",s="",r=[],h=()=>b(t,n.dir??"palbase"),l=()=>{let i=n.environments[e];if(!i)throw new Error(`palbase: the mode "${e}" is not built against any environment \u2014 say which in vite.config: palbase({ environments: { ${JSON.stringify(e)}: '<environment slug>' } })`);return i},g=(i,u)=>{let c=h(),o=E.test(i)?i.replace(E,".ts"):`${i}.ts`;if(v(o)!==c&&v(o)!==f(c,"palbe"))return null;let a=S(c,o),d=`${n.app}.ts`,y=`${n.app}.ssr.ts`;if(a!==d&&a!==y&&!a.startsWith(`palbe${k}`))return null;let m=l(),p=f(c,"environments",m,a===d||a===y?a:f("palbe",a.slice(`palbe${k}`.length)));if(!A(p))throw new Error(`palbase: ${S(t,p)} is not there \u2014 palbase apps:sync writes it (is ${n.app} set in ${m}, and has ${m} that machine?)`);return`${p}${u}`};return{name:"palbase",enforce:"pre",config(i,u){e=u.mode,s=u.command??"";let c=i.build?.rollupOptions?.onwarn;return{build:{rollupOptions:{onwarn(o,a){let d=String(o.exporter??o.id??"");if(o.code==="MISSING_EXPORT"&&d.includes(`${k}environments${k}`))throw new Error(`palbase: ${o.message} \u2014 ${l()}'s backend has no such route (palbase apps:sync brings what it has)`);c?c(o,a):a(o)}}}}},configResolved(i){t=i.root,e=i.mode,s=i.command??s,r=x(i.resolve?.alias)},async buildStart(){s!=="build"||n.typecheck===!1||await D(t,l(),n.tsconfig)},resolveId(i,u){if(!u)return null;let c=h(),o=i.search(/[?#]/),a=o>=0?i.slice(0,o):i,d=o>=0?i.slice(o):"";if(a==="palbase"||a.startsWith("palbase/")){let p=S(c,u);return p.startsWith("..")||p===""?null:this.resolve(i,f(t,"index.html"),{skipSelf:!0})}if(a.startsWith(".")||a.startsWith("/"))return g(b(v(u),a),d);let y=V(a,r);if(y!==null){let p=g(b(t,y),d);if(p!==null)return p}let m=(n.dir??"palbase").replace(/\\/g,"/").replace(/^(\.\/|\.\.\/)+/,"").replace(/\/+$/,"");return a.includes(n.app)||a.includes("/palbe/")||m!==""&&a.includes(m)?this.resolve(i,u,{skipSelf:!0}).then(p=>{let w=p?.id;if(!w)return p;let $=w.search(/[?#]/),j=$>=0?w.slice(0,$):w,P=$>=0?w.slice($):d;return g(j,P)??p}):null}}}function z(n){let t="",e=0;for(;e<n.length;){let s=n[e];if(s==='"')for(t+=s,e++;e<n.length;){let r=n[e];if(t+=r,e++,r==="\\"&&e<n.length)t+=n[e],e++;else if(r==='"')break}else if(s==="/"&&n[e+1]==="/")for(e+=2;e<n.length&&n[e]!==`
|
|
3
3
|
`;)e++;else if(s==="/"&&n[e+1]==="*"){for(e+=2;e<n.length&&!(n[e]==="*"&&n[e+1]==="/");)e++;if(e>=n.length)return null;e+=2,t+=" "}else t+=s,e++}return t}function F(n){let t="",e=0;for(;e<n.length;){let s=n[e];if(s==='"')for(t+=s,e++;e<n.length;){let r=n[e];if(t+=r,e++,r==="\\"&&e<n.length)t+=n[e],e++;else if(r==='"')break}else if(s===","){let r=e+1;for(;r<n.length&&/\s/.test(n[r]);)r++;n[r]!=="}"&&n[r]!=="]"&&(t+=s),e++}else t+=s,e++}return t}function q(n){try{let t=z(n);if(t===null)return null;let e=JSON.parse(F(t));return typeof e!="object"||e===null||Array.isArray(e)?null:e}catch{return null}}function O(n,t=new Set){let e=b(n);if(t.has(e)||!A(e))return!1;t.add(e);let s=q(W(e,"utf8"));if(!s||"files"in s||"include"in s||"references"in s)return!0;let r=s.extends,h=typeof r=="string"?[r]:Array.isArray(r)?r.filter(l=>typeof l=="string"):[];for(let l of h){if(!l.startsWith("."))continue;let g=b(v(e),l.endsWith(".json")?l:`${l}.json`);if(O(g,t))return!0}return!1}async function D(n,t,e){let s=e?b(n,e):["tsconfig.app.json","tsconfig.json"].map(l=>f(n,l)).find(A);if(!s)return;if(!A(s))throw new Error(`palbase({ tsconfig }): ${S(n,s)} is not there`);let r;try{let l=I(f(n,"package.json")).resolve("typescript/package.json"),g=JSON.parse(W(l,"utf8")).bin?.tsc;if(!g)throw new Error("no tsc");r=f(v(l),g)}catch{throw new Error("palbase: the build type-checks the app against its environment with the app's TypeScript, and the app has none (npm i -D typescript) \u2014 or say palbase({ typecheck: false })")}let h=C(f(T(),"palbase-typecheck-"));try{let l=f(h,"tsconfig.json"),g=O(s)?{}:{include:[f(n,"**/*")],exclude:[f(n,"node_modules"),f(n,"dist")]};N(l,JSON.stringify({extends:s,...g,compilerOptions:{noEmit:!0,composite:!1,incremental:!1,moduleSuffixes:[`.${t}`,""]}}));let i=await new Promise(u=>R(process.execPath,[r,"-p",l,"--pretty","false"],{cwd:n,maxBuffer:16<<20},(c,o,a)=>u({code:c?typeof c.code=="number"?c.code:1:0,text:`${o}${a}`.trim()})));if(i.code!==0)throw new Error(`palbase: the app does not type-check against ${t}, the environment this build is made for \u2014 a route its backend does not have, or a call that does not fit it:
|
|
4
4
|
${i.text}`)}finally{J(h,{recursive:!0,force:!0})}}export{U as palbase};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "palbase",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.76.0",
|
|
4
4
|
"description": "Palbase for JavaScript: the web client (palbase/web), the server SDK (palbase/server), an organization's management SDK (palbase/cloud), the backend framework (palbase/backend), AI (palbase/ai) and the CLI (npx palbase).",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE",
|
|
6
6
|
"homepage": "https://palbase.studio",
|
|
@@ -167,7 +167,7 @@
|
|
|
167
167
|
"@types/node": "26.6.4",
|
|
168
168
|
"bun-types": "1.4.5",
|
|
169
169
|
"livekit-client": "^2.23.0",
|
|
170
|
-
"palgres": "0.
|
|
170
|
+
"palgres": "0.76.0",
|
|
171
171
|
"reflect-metadata": "^0.2.2",
|
|
172
172
|
"typescript": "~6.0.3",
|
|
173
173
|
"zod": "^4.6.5"
|
|
@@ -98,6 +98,15 @@ export declare const servedByTheApp: (g: GatewayDeclaration) => boolean;
|
|
|
98
98
|
export interface GatewayUser {
|
|
99
99
|
/** The user's id; "" in @OnFirst and @OnEmpty, which no one in particular caused. */
|
|
100
100
|
id: string;
|
|
101
|
+
/**
|
|
102
|
+
* The sign-in the member's socket is of: one for each device the user signed
|
|
103
|
+
* in on, the same across that device's reconnects and its token's renewals —
|
|
104
|
+
* what tells one user's devices apart, for a room that shows who is in it.
|
|
105
|
+
* It names the sign-in to the app alone: a room that tells its members of
|
|
106
|
+
* each other names them by something made from it. Absent in @OnFirst and
|
|
107
|
+
* @OnEmpty, and for a token of no session.
|
|
108
|
+
*/
|
|
109
|
+
session?: string;
|
|
101
110
|
}
|
|
102
111
|
/** What @Authorize is given: who asks to join, and the channel's parameters. */
|
|
103
112
|
export interface GatewayAuthorizeContext {
|