palbase 0.25.1 → 0.26.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/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/{G6HTDGFI.js → 2LNRLAVP.js} +2 -2
- package/dist/chunks/{FCJKKXVF.js → 4I34RRBK.js} +1 -1
- package/dist/chunks/{4CLXBBRV.js → 4W2CWOGO.js} +1 -1
- package/dist/chunks/{CIVBMN5Z.js → 5RWEOPF2.js} +2 -2
- package/dist/chunks/{3NXLBGEQ.js → 72VOVUBT.js} +2 -2
- package/dist/chunks/{Y5WCHNQI.js → B4ZHHG4H.js} +2 -2
- package/dist/chunks/{JPUEFD5R.js → BN5FJ3YM.js} +1 -1
- package/dist/chunks/{JRVM63RG.js → CZMQEBC6.js} +2 -2
- package/dist/chunks/{HRPJA5AL.js → DK2JMPU3.js} +2 -2
- package/dist/chunks/{RRMYWHH6.js → DVRO2E2S.js} +2 -2
- package/dist/chunks/{IERZK64H.js → EAHHUIQP.js} +1 -1
- package/dist/chunks/{YE7MYOBE.js → FBCZT7JT.js} +2 -2
- package/dist/chunks/{7HZ4EKJP.js → GHQTIJT7.js} +2 -2
- package/dist/chunks/{5XNUS4RO.js → HMQIA6DH.js} +2 -2
- package/dist/chunks/{GP64QR4G.js → M5MRZQPV.js} +2 -2
- package/dist/chunks/{B3UA4AVW.js → OTWMAAPL.js} +2 -2
- package/dist/chunks/{3SLLOZC4.js → Q4E3WXGS.js} +1 -1
- package/dist/chunks/{LSJGREA3.js → QUPZ6GF5.js} +2 -2
- package/dist/chunks/{JN6E6CVV.js → QUX35QKY.js} +2 -2
- package/dist/chunks/{IVTH3I2M.js → RC4ZSGS2.js} +2 -2
- package/dist/chunks/{VFPMVP2K.js → SB36QYBM.js} +2 -2
- package/dist/chunks/{BA4P3PMP.js → UKRY3HRA.js} +1 -1
- package/dist/chunks/{Q2SNPNA4.js → V2OJIKUV.js} +1 -1
- package/dist/cli.js +2 -2
- package/dist/cloud/index.js +2 -2
- 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/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/cloud/src/generated/project.d.ts +1 -1
- package/types/internal/src/modules/messaging.d.ts +68 -6
package/dist/server/testing.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! palbase 0.
|
|
2
|
-
import{a,b,c,d,e}from"../chunks/
|
|
1
|
+
/*! palbase 0.26.0 — Palbase SDK License (see LICENSE) */
|
|
2
|
+
import{a,b,c,d,e}from"../chunks/B4ZHHG4H.js";import"../chunks/Q4E3WXGS.js";import"../chunks/4I34RRBK.js";import"../chunks/UKRY3HRA.js";export{b as TestApiError,e as api,c as createTestApi,a as testFields,d as testRun};
|
package/dist/web/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! palbase 0.
|
|
2
|
-
import{a as I,b as j,c as q,d as G,e as D,f as H,g as N,h as U,i as F,j as B,k as J,l as K,m as W,n as X,o as Y,p as Z,q as ee,r as te,s as ne,t as re,u as oe,v as se,w as ae,x as ie}from"../chunks/
|
|
1
|
+
/*! palbase 0.26.0 — Palbase SDK License (see LICENSE) */
|
|
2
|
+
import{a as I,b as j,c as q,d as G,e as D,f as H,g as N,h as U,i as F,j as B,k as J,l as K,m as W,n as X,o as Y,p as Z,q as ee,r as te,s as ne,t as re,u as oe,v as se,w as ae,x as ie}from"../chunks/72VOVUBT.js";import{a as _,b as Q,f as z}from"../chunks/QUX35QKY.js";import"../chunks/SB36QYBM.js";import"../chunks/DVRO2E2S.js";import"../chunks/CZMQEBC6.js";import"../chunks/V2OJIKUV.js";import{b as S,c as T,d as O,f as x,g as R,j as A,k as V,l as M,m as E,o as v}from"../chunks/4W2CWOGO.js";import"../chunks/QUPZ6GF5.js";import"../chunks/GHQTIJT7.js";import{b as L}from"../chunks/FBCZT7JT.js";import"../chunks/4I34RRBK.js";import"../chunks/UKRY3HRA.js";var ce="oai-events";async function pe(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??le(),t=e.signal;t?.throwIfAborted();let l=e.audio??ue(),f=e.microphone===void 0,c=e.microphone??await r.getUserMedia({audio:!0});if(t?.aborted){if(f)for(let n of c.getTracks())n.stop();throw t.reason}let o=new r.RTCPeerConnection,s=!1,u=()=>{if(!s){if(s=!0,m.close(),o.close(),f)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 m=o.createDataChannel(ce);m.addEventListener("message",n=>{let d=ye(n.data);d!==void 0&&e.onError?.(d)});let p=()=>u();t?.addEventListener("abort",p,{once:!0});try{await o.setLocalDescription(await o.createOffer()),t?.throwIfAborted(),await de(o,e.iceTimeoutMs??1e4,t);let n=o.localDescription?.sdp;if(!n)throw new Error("connectVoice: the peer connection made no offer");let d=await e.start(n);if(t?.throwIfAborted(),typeof d?.id!="string"||d.id===""||typeof d.sdp!="string"||d.sdp==="")throw new TypeError("connectVoice: start answered no voice \u2014 it is { id, sdp }, chats.voice.start's answer as the backend got it");return await o.setRemoteDescription({type:"answer",sdp:d.sdp}),t?.removeEventListener("abort",p),{id:d.id,peer:o,audio:l,microphone:c,get muted(){return c.getAudioTracks().every(h=>!h.enabled)},mute(h){for(let w of c.getAudioTracks())w.enabled=!h},close:u}}catch(n){throw t?.removeEventListener("abort",p),u(),t?.aborted?t.reason:n}}function de(e,r,t){return e.iceGatheringState==="complete"?Promise.resolve():t?.aborted?Promise.reject(t.reason):new Promise((l,f)=>{let c=()=>{clearTimeout(u),e.removeEventListener("icegatheringstatechange",o),t?.removeEventListener("abort",s)},o=()=>{e.iceGatheringState==="complete"&&(c(),l())},s=()=>{c(),f(t?.reason)},u=setTimeout(()=>{c(),f(new Error(`connectVoice: the network candidates were not gathered in ${r} ms`))},r);e.addEventListener("icegatheringstatechange",o),t?.addEventListener("abort",s,{once:!0})})}function ye(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 le(){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 ue(){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 fe(e,r,t){let l=i(i(i(e)?.components)?.schemas)??{},f=(p,n)=>{let d=new Set,h=(b,g,y)=>{let a=i(b);if(!a)return;if(typeof a.$ref=="string"){if(y.has(a.$ref)||!a.$ref.startsWith("#/components/schemas/"))return;h(l[a.$ref.slice(21)],g,new Set(y).add(a.$ref));return}if(a[S]===!0){d.add(g);return}for(let C of["anyOf","oneOf","allOf"]){let k=a[C];if(Array.isArray(k))for(let $ of k)h($,g,y)}let P=i(a.properties);if(P)for(let[C,k]of Object.entries(P))h(k,`${g}/${E(C)}`,y);i(a.items)&&h(a.items,`${g}/*`,y);for(let C of["additionalProperties","patternProperties","prefixItems"])if(a[C]!==void 0&&w(a[C],new Set(y)))throw new Error(`${t}: an encrypted field is a named property \u2014 not every key of a record, nor a tuple's place`)},w=(b,g)=>{if(Array.isArray(b))return b.some(a=>w(a,g));let y=i(b);return y?y[S]===!0?!0:typeof y.$ref=="string"&&!g.has(y.$ref)&&y.$ref.startsWith("#/components/schemas/")?(g.add(y.$ref),w(l[y.$ref.slice(21)],g)):Object.values(y).some(a=>typeof a=="object"&&a!==null&&w(a,g)):!1};return h(p,n,new Set),[...d]},c=p=>i(i(i(p)?.["application/json"])?.schema),o=[];o.push(...f(c(i(r.requestBody)?.content),"/body"));for(let p of Array.isArray(r.parameters)?r.parameters:[]){let n=i(p);if(!n)continue;let d=f(n.schema,`/query/${E(String(n.name))}`);if(d.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(d.some(h=>h.split("/").length!==3))throw new Error(`${t}: an encrypted query field is one of the query's own names`);o.push(...d)}}let s=i(r.responses)??{},u=Object.keys(s).filter(p=>/^2\d\d$/.test(p)).sort((p,n)=>p==="200"?-1:n==="200"?1:p.localeCompare(n)),m=u.length>0?f(c(i(s[u[0]])?.content),"/response"):[];if(o.length+m.length!==0){if(r["x-palbase-sse"]!==void 0&&m.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:m}}}async function me(e){let r=`${e.method.toUpperCase()} ${e.path}`,t=i(i(i(i(e.contract)?.paths)?.[e.path])?.[e.method.toLowerCase()]),l=t?fe(e.contract,t,r):void 0;if(!l)return{body:e.body,query:e.query,open:async s=>s};let{key:f,header:c}=await R(e.key.kid,O(e.key.publicKey),x(e.projectId,e.method,e.path,e.params??[])),o=(s,u)=>s==null?s:v(s,u,l.request,(m,p)=>A(f,m,p));return{header:c,body:await o(e.body,"/body"),query:await o(e.query,"/query"),open:s=>s===void 0?Promise.resolve(s):v(s,"/response",l.response,async(u,m)=>{if(!V(m))throw new T("unopenable",`${r}: ${u} came plain where the contract says it is encrypted`);return M(f,u,m)})}}export{N as Analytics,_ as BackendError,G as Channel,U as Consent,ne as ConversationList,oe as ConversationView,re as DeletedGroupList,Z as Flags,z as GatewayError,J as InApp,F as Inbox,H as Installation,te as Messaging,W as Notify,L as PalbaseError,X as Purchases,D as RealtimeSocket,B as SESSION_START,ae as ScheduledList,I as SessionChangedError,se as ThreadView,K as WebPush,pe as connectVoice,ie as createClient,me as encryptedCall,ee as indexedDBKeyValue,Q as isBackendError,q as localStore,j as memoryStore,Y as redemptionToken};
|
package/dist/web/message.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! palbase 0.
|
|
2
|
-
import{a as i}from"../chunks/
|
|
1
|
+
/*! palbase 0.26.0 — Palbase SDK License (see LICENSE) */
|
|
2
|
+
import{a as i}from"../chunks/CZMQEBC6.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/V2OJIKUV.js";import"../chunks/UKRY3HRA.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.26.0 — Palbase SDK License (see LICENSE) */
|
|
2
|
+
import{c as e,d as r,i as t}from"../chunks/QUX35QKY.js";import"../chunks/SB36QYBM.js";import"../chunks/4W2CWOGO.js";import"../chunks/GHQTIJT7.js";import"../chunks/FBCZT7JT.js";import"../chunks/4I34RRBK.js";import"../chunks/UKRY3HRA.js";export{e as RESERVED_CLIENT_NAMES,t as __registerBackend,r as isClientName};
|
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.26.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/DVRO2E2S.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/V2OJIKUV.js";import"../chunks/FBCZT7JT.js";import"../chunks/4I34RRBK.js";import"../chunks/UKRY3HRA.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.26.0 — Palbase SDK License (see LICENSE) */
|
|
2
2
|
"use strict";(()=>{function g(n,s){if(n)try{let i=new URL(n,s);if(i.protocol==="https:"||i.protocol==="http:"&&(i.hostname==="localhost"||i.hostname==="127.0.0.1"))return i.href}catch{}}function p(n){let s=new URL(n.location.href).searchParams,i=s.get("url")??"",u=s.get("key")??"",a=(t,e)=>!t||!i?Promise.resolve():n.fetch(`${i.replace(/\/$/,"")}/notify/receipts`,{method:"POST",headers:{"content-type":"application/json",apikey:u},body:JSON.stringify({receipts:[{receipt:t,status:e}]}),keepalive:!0}).catch(()=>{}),l=async(t,e)=>{for(let o of await n.clients.matchAll({type:"window",includeUncontrolled:!0}))o.postMessage({type:"palbase.push",event:t,url:e.url,data:e.data})};n.addEventListener("push",(t=>{let e={};try{e=t.data?.json()??{}}catch{}let o={url:e.url,receipt:e.receipt,data:e.data},d=async()=>e.data?.type==="messaging.message"&&(await n.clients.matchAll({type:"window",includeUncontrolled:!0})).some(r=>r.focused===!0);t.waitUntil(d().then(r=>r?void 0:n.registration.showNotification(e.title??"",{body:e.body,image:e.image,tag:e.tag,data:o})).then(()=>Promise.all([a(e.receipt,"delivered"),l("received",o)])))})),n.addEventListener("notificationclick",(t=>{t.notification.close();let e=t.notification.data??{},o=g(e.url,n.location.origin),d=async()=>{if(!o)return;let c=(await n.clients.matchAll({type:"window",includeUncontrolled:!0})).find(f=>f.url===o);c?await c.focus():await n.clients.openWindow(o)};t.waitUntil(Promise.all([a(e.receipt,"opened"),d(),l("opened",e)]))})),n.addEventListener("notificationclose",(t=>{t.waitUntil(a(t.notification.data?.receipt,"dismissed"))}))}typeof self<"u"&&typeof self.registration=="object"&&!("document"in self)&&p(self);})();
|
package/dist/web/ssr.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! palbase 0.
|
|
2
|
-
import{x as f}from"../chunks/
|
|
1
|
+
/*! palbase 0.26.0 — Palbase SDK License (see LICENSE) */
|
|
2
|
+
import{x as f}from"../chunks/72VOVUBT.js";import"../chunks/QUX35QKY.js";import"../chunks/SB36QYBM.js";import"../chunks/DVRO2E2S.js";import"../chunks/CZMQEBC6.js";import"../chunks/V2OJIKUV.js";import"../chunks/4W2CWOGO.js";import"../chunks/QUPZ6GF5.js";import"../chunks/GHQTIJT7.js";import"../chunks/FBCZT7JT.js";import"../chunks/4I34RRBK.js";import"../chunks/UKRY3HRA.js";var C=Object.freeze({"Cache-Control":"private, no-cache, no-store, must-revalidate, max-age=0",Expires:"0",Pragma:"no-cache"}),x={path:"/",sameSite:"lax",secure:!0,httpOnly:!1,maxAge:400*24*60*60},u=3180,k=5*6e4;function d(t){let e=/^pb_([a-z0-9]+)_c/.exec(t)?.[1];if(e===void 0)throw new TypeError("publishableKey is the project publishable key (pb_<ref>_c\u2026)");return`pb-${e}-session`}var y=t=>{let e=new TextEncoder().encode(JSON.stringify(t)),o="";for(let s of e)o+=String.fromCharCode(s);return btoa(o).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")},b=t=>{try{let e=atob(t.replace(/-/g,"+").replace(/_/g,"/")),o=JSON.parse(new TextDecoder().decode(Uint8Array.from(e,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}};function m(t,e,o={},s=!1){let c={...x,...o},g=async()=>new Map((await e.getAll()).map(n=>[n.name,n.value])),S=n=>n===t||n.startsWith(`${t}.`)&&/^\d+$/.test(n.slice(t.length+1)),h=async n=>{if(!e.setAll)return;let i=n===null?[]:n.length<=u?[[t,n]]:Array.from({length:Math.ceil(n.length/u)},(r,l)=>[`${t}.${l}`,n.slice(l*u,(l+1)*u)]),p=new Set(i.map(([r])=>r)),a=i.map(([r,l])=>({name:r,value:l,options:c}));for(let r of(await g()).keys())S(r)&&!p.has(r)&&a.push({name:r,value:"",options:{...c,maxAge:0}});a.length>0&&await e.setAll(a,{...C})};return{async load(){let n=await g(),i=n.get(t);if(i===void 0){let p="";for(let a=0;n.has(`${t}.${a}`);a++)p+=n.get(`${t}.${a}`);i=p}return i?b(i):null},save:n=>h(y(n)),clear:()=>h(null),shared:s}}function A(t){let{cookies:e,cookieOptions:o,...s}=t,c=t.refresh??(e.setAll?"before":"never");return f({...s,refresh:c,storage:m(d(t.publishableKey),e,o)})}function O(){let t=()=>{let e=globalThis.document;if(!e)throw new Error("documentCookies: there is no document here \u2014 a server gives its request's cookies to createServerClient");return e};return{getAll:()=>t().cookie.split(";").map(e=>e.trim()).filter(e=>e.includes("=")).map(e=>{let o=e.indexOf("=");return{name:e.slice(0,o),value:e.slice(o+1)}}),setAll(e){for(let o of e){let s=o.options,c=[`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);t().cookie=[`${o.name}=${o.value}`,...c].join("; ")}}}}function $(t){let{cookieOptions:e,...o}=t,s=globalThis.location?.protocol==="https:";return f({...o,storage:m(d(t.publishableKey),O(),{secure:s,...e},!0)})}async function v(t){let e=await t.auth.currentSession();if(!e||(e.expiresAt-Date.now()<=k&&await t.auth.refreshSession().catch(()=>{}),!await t.auth.currentSession()))return null;try{return(await t.auth.api.verifyTokenUser()).data}catch(o){if(o.status===401)return null;throw o}}export{C as NO_STORE_HEADERS,x as SESSION_COOKIE_OPTIONS,m as cookieSessionStore,$ as createBrowserClient,A as createServerClient,O as documentCookies,v as keepSession,d as sessionCookieName};
|
package/dist/web/vite.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/*! palbase 0.
|
|
2
|
-
import"../chunks/
|
|
1
|
+
/*! palbase 0.26.0 — Palbase SDK License (see LICENSE) */
|
|
2
|
+
import"../chunks/UKRY3HRA.js";import{execFile as $}from"node:child_process";import{existsSync as y,mkdtempSync as k,readFileSync as S,rmSync as x,writeFileSync as P}from"node:fs";import{createRequire as O}from"node:module";import{tmpdir as W}from"node:os";import{dirname as g,join as o,relative as u,resolve as v,sep as d}from"node:path";var E=/\.(?:ts|js|mts|mjs)$/;function F(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 c=process.cwd(),p="",i="",f=()=>v(c,n.dir??"palbase"),m=()=>{let e=n.environments[p];if(!e)throw new Error(`palbase: the mode "${p}" is not built against any environment \u2014 say which in vite.config: palbase({ environments: { ${JSON.stringify(p)}: '<environment slug>' } })`);return e};return{name:"palbase",enforce:"pre",config(e,s){p=s.mode,i=s.command??"";let r=e.build?.rollupOptions?.onwarn;return{build:{rollupOptions:{onwarn(t,a){let l=String(t.exporter??t.id??"");if(t.code==="MISSING_EXPORT"&&l.includes(`${d}environments${d}`))throw new Error(`palbase: ${t.message} \u2014 ${m()}'s backend has no such route (palbase apps:sync brings what it has)`);r?r(t,a):a(t)}}}}},configResolved(e){c=e.root,p=e.mode,i=e.command??i},async buildStart(){i!=="build"||n.typecheck===!1||await j(c,m(),n.tsconfig)},resolveId(e,s){if(!s)return null;let r=f();if(e==="palbase"||e.startsWith("palbase/")){let w=u(r,s);return w.startsWith("..")||w===""?null:this.resolve(e,o(c,"index.html"),{skipSelf:!0})}if(!(e.startsWith(".")||e.startsWith("/")))return null;let t=v(g(s),e);if(E.test(t)||(t+=".ts"),g(t)!==r&&g(t)!==o(r,"palbe"))return null;let a=u(r,t),l=`${n.app}.ts`;if(a!==l&&!a.startsWith(`palbe${d}`))return null;let h=m(),b=o(r,"environments",h,a===l?l:o("palbe",a.slice(`palbe${d}`.length)));if(!y(b))throw new Error(`palbase: ${u(c,b)} is not there \u2014 palbase apps:sync writes it (is ${n.app} set in ${h}, and has ${h} that machine?)`);return b}}}async function j(n,c,p){let i=p?v(n,p):["tsconfig.app.json","tsconfig.json"].map(e=>o(n,e)).find(y);if(!i)return;if(!y(i))throw new Error(`palbase({ tsconfig }): ${u(n,i)} is not there`);let f;try{let e=O(o(n,"package.json")).resolve("typescript/package.json"),s=JSON.parse(S(e,"utf8")).bin?.tsc;if(!s)throw new Error("no tsc");f=o(g(e),s)}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 m=k(o(W(),"palbase-typecheck-"));try{let e=o(m,"tsconfig.json");P(e,JSON.stringify({extends:i,compilerOptions:{noEmit:!0,composite:!1,incremental:!1,moduleSuffixes:[`.${c}`,""]}}));let s=await new Promise(r=>$(process.execPath,[f,"-p",e,"--pretty","false"],{cwd:n,maxBuffer:16<<20},(t,a,l)=>r({code:t?typeof t.code=="number"?t.code:1:0,text:`${a}${l}`.trim()})));if(s.code!==0)throw new Error(`palbase: the app does not type-check against ${c}, the environment this build is made for \u2014 a route its backend does not have, or a call that does not fit it:
|
|
3
3
|
${s.text}`)}finally{x(m,{recursive:!0,force:!0})}}export{F as palbase};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "palbase",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.26.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",
|
|
@@ -149,7 +149,7 @@
|
|
|
149
149
|
"dependencies": {
|
|
150
150
|
"@types/node": "26.6.4",
|
|
151
151
|
"bun-types": "1.4.2",
|
|
152
|
-
"palgres": "0.
|
|
152
|
+
"palgres": "0.26.0",
|
|
153
153
|
"reflect-metadata": "^0.2.2",
|
|
154
154
|
"typescript": "~6.0.3",
|
|
155
155
|
"zod": "^4.6.5"
|
|
@@ -8,7 +8,7 @@ export interface Project {
|
|
|
8
8
|
flags: Pick<modules.flags.Client, "getValues" | "batchUserValues" | "getDelta" | "getEvaluations" | "listExperiments" | "startExperiment" | "getExperiment" | "getExperimentResults" | "stopExperiment" | "declareExperimentWinner" | "getCurrentInstallations" | "getInstallationsDaily" | "getSnapshot" | "listDefinitions" | "getDefinition" | "putDefinition" | "deleteDefinition" | "activateTemplates" | "getActiveTemplate" | "getTemplateCapabilities" | "getTemplateDraft" | "createTemplateDraft" | "discardTemplateDraft" | "putTemplateParameter" | "removeTemplateParameter" | "reviewTemplateDraft" | "publishTemplate" | "getPublishReceipt" | "restoreTemplateVersion" | "listTemplateVersions" | "getTemplateVersion" | "getUserValues" | "putUserValues" | "deleteUserValues" | "putUserValue" | "deleteUserValue">;
|
|
9
9
|
journeys: Pick<modules.journeys.Client, "listJourneys" | "createJourney" | "listPersonRuns" | "simulateJourney" | "validateJourney" | "getJourney" | "updateJourney" | "deleteJourney" | "copyJourney" | "publishJourney" | "listJourneyRuns" | "getJourneyStats" | "stopJourney" | "testJourney">;
|
|
10
10
|
machines: Pick<modules.machines.Client, "listMachines" | "createMachine" | "listMachineSizes" | "getMachineNetwork" | "connectGitHub" | "listInstallations" | "linkInstallation" | "shareInstallation" | "unlinkInstallation" | "listRepositories" | "getMachine" | "deleteMachine" | "updateMachine" | "listBuilds" | "deployMachine" | "listMachinePreviews" | "listMachineDomains" | "addMachineDomain" | "deleteMachineDomain" | "getBuild" | "getBuildLog" | "rollbackMachine" | "listDatabases" | "createDatabase" | "listDatabaseSizes" | "getDatabase" | "deleteDatabase" | "updateDatabase" | "undeleteDatabase" | "purgeDatabase" | "getDatabaseCredentials" | "changeDatabasePassword" | "readMachineLogs" | "getMachineMetrics" | "getMachineContract" | "restoreDatabase" | "getDatabaseSchema" | "getDatabaseMetrics" | "queryDatabase" | "listCrons" | "listCronRuns" | "runCron" | "pauseCron" | "resumeCron" | "listTasks" | "enqueueTask" | "getTask" | "cancelTask" | "retryTask" | "listTaskTypes" | "makeTemplatedTestUsers" | "templateTestUser" | "deleteTemplatedTestUser" | "listSites" | "createSite" | "getSite" | "deleteSite" | "updateSite" | "listSiteReleases" | "createSiteRelease" | "uploadSiteFile" | "finishSiteRelease" | "rollbackSite" | "listSiteBuilds" | "deploySite" | "listSitePreviews" | "listSiteDomains" | "addSiteDomain" | "deleteSiteDomain" | "getSiteBuild">;
|
|
11
|
-
messaging: Pick<modules.messaging.Client, "adminAccessLog" | "adminListConversations" | "adminCreateConversation" | "adminGetConversation" | "adminDeleteConversation" | "adminAddMembers" | "adminRemoveMember" | "adminListMessages" | "adminSendMessage" | "adminDeleteMessage" | "adminFileUrl" | "adminPutProfile" | "adminListReports" | "adminGetReport" | "adminReportFileUrl" | "adminResolveReport" | "getSettings" | "putSettings" | "rotateHookSecret">;
|
|
11
|
+
messaging: Pick<modules.messaging.Client, "adminAccessLog" | "adminListConversations" | "adminCreateConversation" | "adminGetConversation" | "adminDeleteConversation" | "adminUpdateConversation" | "adminAddMembers" | "adminRemoveMember" | "adminListMessages" | "adminSendMessage" | "adminDeleteMessage" | "adminFileUrl" | "adminPutProfile" | "adminListReports" | "adminGetReport" | "adminReportFileUrl" | "adminResolveReport" | "getSettings" | "putSettings" | "rotateHookSecret">;
|
|
12
12
|
notify: Pick<modules.notify.Client, "getDeliverability" | "listDevices" | "getDeviceStats" | "deleteMyDevice" | "sendEmail" | "listInAppCampaigns" | "createInAppCampaign" | "getInAppCampaign" | "putInAppCampaign" | "deleteInAppCampaign" | "getInAppCampaignStats" | "listInAppTemplates" | "sendInbox" | "listInboxMessages" | "listNotifyMessages" | "getNotifyMessage" | "cancelMessage" | "getMetricsSummary" | "listNotifyProviders" | "putNotifyProvider" | "deleteNotifyProvider" | "sendPush" | "getNotifySettings" | "putNotifySettings" | "sendSms" | "listEmailTemplates" | "getEmailTemplate" | "putEmailTemplate" | "deleteEmailTemplate" | "listPushTemplates" | "getPushTemplate" | "putPushTemplate" | "deletePushTemplate" | "listSmsTemplates" | "getSmsTemplate" | "putSmsTemplate" | "deleteSmsTemplate" | "listWhatsAppTemplates" | "getWhatsAppTemplate" | "putWhatsAppTemplate" | "deleteWhatsAppTemplate" | "listTestUserMessages" | "listTopics" | "createTopic" | "deleteTopic" | "changeTopic" | "addTopicSubscribers" | "removeTopicSubscriber" | "listUserDevices" | "getUserPreferences" | "setUserPreferences" | "startVerification" | "checkVerification" | "getWebPushStatus" | "sendWhatsApp" | "listWhatsAppInbound">;
|
|
13
13
|
purchases: Pick<modules.purchases.Client, "getAppleAccount" | "disconnectApple" | "createAppleGrant" | "getAppleReadiness" | "setXcodeCertificate" | "clearXcodeCertificate" | "getGoogleAccount" | "connectGoogle" | "disconnectGoogle" | "getCatalog" | "saveCatalog" | "planCatalog" | "getCatalogPlan" | "confirmCatalogPlan" | "declineCatalogPlan" | "validateCatalog" | "listCharts" | "getChartsOverview" | "getChart" | "getCustomer" | "grantCredits" | "listCreditEntries" | "forgiveCredits" | "listCustomerGrants" | "grantEntitlement" | "revokeGrant" | "holdSpend" | "setCustomerLimit" | "clearCustomerLimit" | "grantLimit" | "spend" | "commitSpend" | "extendHold" | "releaseSpend" | "reverseSpend" | "listExperiments" | "startExperiment" | "getExperiment" | "getExperimentResults" | "stopExperiment" | "declareExperimentWinner" | "getOfferings" | "listPaywalls" | "createPaywall" | "listPaywallAssets" | "registerPaywallAsset" | "deletePaywallAsset" | "listPaywallTemplates" | "getPaywallTemplateAsset" | "validatePaywall" | "getPaywall" | "deletePaywall" | "savePaywallDraft" | "publishPaywall" | "listPaywallVersions" | "getPaywallVersion" | "listPlacements" | "listAttributeKeys" | "setPlacement" | "deletePlacement" | "recordPaywallExposure" | "getPlacementPaywall" | "previewPlacement" | "getPlacementResults" | "getPlacementRules" | "setPlacementRules" | "getSettings" | "updateSettings" | "getStripeAccount" | "disconnectStripe" | "checkStripeAccount" | "createCheckout" | "createCheckoutRedemption" | "createStripeGrant" | "createStripeAppInstall" | "getOfferStats" | "listCoupons" | "createCoupon" | "getCoupon" | "revokeCoupon" | "listCouponCodes" | "setXcodeOfferKey" | "searchCustomers" | "getCustomerHistory" | "listCatalogRevisions" | "getCatalogRevision" | "restoreCatalogRevision" | "extendSubscription" | "refundSubscription" | "cancelSubscription">;
|
|
14
14
|
realtime: Pick<modules.realtime.Client, "broadcast" | "getChannels" | "putChannels" | "getLimits" | "putLimits" | "revalidate" | "writeState" | "getStats">;
|
|
@@ -115,6 +115,51 @@ export type AdminProfileRequest = {
|
|
|
115
115
|
*/
|
|
116
116
|
name?: string | null;
|
|
117
117
|
};
|
|
118
|
+
/**
|
|
119
|
+
* What the project's server changes in a conversation: what its admins may, and whether it is read-only; what it names changes.
|
|
120
|
+
*/
|
|
121
|
+
export type AdminUpdateConversation = {
|
|
122
|
+
/**
|
|
123
|
+
* Who adds people.
|
|
124
|
+
*/
|
|
125
|
+
add_policy?: "all" | "admins";
|
|
126
|
+
/**
|
|
127
|
+
* A group's description; null clears it.
|
|
128
|
+
*/
|
|
129
|
+
description?: string | null;
|
|
130
|
+
/**
|
|
131
|
+
* Who changes details and timer.
|
|
132
|
+
*/
|
|
133
|
+
edit_policy?: "all" | "admins";
|
|
134
|
+
/**
|
|
135
|
+
* Whether someone added reads what was said before them.
|
|
136
|
+
*/
|
|
137
|
+
history_for_new_members?: boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Where the app reads a group's picture; null clears it.
|
|
140
|
+
*/
|
|
141
|
+
photo?: string | null;
|
|
142
|
+
/**
|
|
143
|
+
* Read-only: its people read what was said in it, nobody writes in it (no message, reaction, edit, file, or change to its details); false makes it writable again. Told in it as read_only_on / read_only_off.
|
|
144
|
+
*/
|
|
145
|
+
read_only?: boolean;
|
|
146
|
+
/**
|
|
147
|
+
* Who writes: all or admins.
|
|
148
|
+
*/
|
|
149
|
+
send_policy?: "all" | "admins";
|
|
150
|
+
/**
|
|
151
|
+
* How long a new message lives; null: for good.
|
|
152
|
+
*/
|
|
153
|
+
timer_seconds?: number | null;
|
|
154
|
+
/**
|
|
155
|
+
* A group's title.
|
|
156
|
+
*/
|
|
157
|
+
title?: string | null;
|
|
158
|
+
/**
|
|
159
|
+
* A direct conversation's vanish mode.
|
|
160
|
+
*/
|
|
161
|
+
vanish?: boolean;
|
|
162
|
+
};
|
|
118
163
|
/**
|
|
119
164
|
* A file a message carries.
|
|
120
165
|
*/
|
|
@@ -369,6 +414,10 @@ export type ConversationSettings = {
|
|
|
369
414
|
* Whether someone added reads what was said before them.
|
|
370
415
|
*/
|
|
371
416
|
history_for_new_members: boolean;
|
|
417
|
+
/**
|
|
418
|
+
* Read-only (the project's server's word): its people read what was said in it, nobody writes in it — no message, reaction, edit, file, or change to its details; the server still may. Always sent; absent (an answer kept from before it was): false.
|
|
419
|
+
*/
|
|
420
|
+
read_only?: boolean;
|
|
372
421
|
/**
|
|
373
422
|
* Who writes in the group: all or admins.
|
|
374
423
|
*/
|
|
@@ -845,9 +894,9 @@ export type MyProfile = {
|
|
|
845
894
|
*/
|
|
846
895
|
export type NotAdded = {
|
|
847
896
|
/**
|
|
848
|
-
* not_allowed (the project's hook did not let them be reached, or they block whoever added them) or
|
|
897
|
+
* not_allowed (the project's hook did not let them be reached, or they block whoever added them), group_full, or user_deleted (their account was deleted).
|
|
849
898
|
*/
|
|
850
|
-
reason: "not_allowed" | "group_full";
|
|
899
|
+
reason: "not_allowed" | "group_full" | "user_deleted";
|
|
851
900
|
/**
|
|
852
901
|
* The person.
|
|
853
902
|
*/
|
|
@@ -1456,7 +1505,7 @@ export type SystemEvent = {
|
|
|
1456
1505
|
*/
|
|
1457
1506
|
title?: string;
|
|
1458
1507
|
/**
|
|
1459
|
-
* What happened: created, members_added, member_left, member_removed, role_changed, title_changed, description_changed, photo_changed, timer_changed, vanish_on, vanish_off, settings_changed, screenshot.
|
|
1508
|
+
* What happened: created, members_added, member_left, member_removed, role_changed, title_changed, description_changed, photo_changed, timer_changed, vanish_on, vanish_off, settings_changed, read_only_on, read_only_off, screenshot. A person whose account was deleted is named deleted_… here, as everywhere.
|
|
1460
1509
|
*/
|
|
1461
1510
|
type: string;
|
|
1462
1511
|
/**
|
|
@@ -1761,11 +1810,12 @@ export declare function client(t: Transport): {
|
|
|
1761
1810
|
/**
|
|
1762
1811
|
* The project's conversations
|
|
1763
1812
|
*
|
|
1764
|
-
* The project's conversations (a person's, when `user_id` names one), the latest first.
|
|
1813
|
+
* The project's conversations (a person's, when `user_id` names one; the direct one of two, when `with` names the other), the latest first.
|
|
1765
1814
|
*/
|
|
1766
1815
|
adminListConversations(input?: {
|
|
1767
1816
|
query?: {
|
|
1768
|
-
user_id?: string; /**
|
|
1817
|
+
user_id?: string; /** Another person, beside user_id: the direct conversation of the two (none when they have none). */
|
|
1818
|
+
with?: string; /** How many (1 to 100; 30 when absent). */
|
|
1769
1819
|
limit?: number; /** The cursor a page handed out (next_cursor). */
|
|
1770
1820
|
cursor?: string;
|
|
1771
1821
|
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
@@ -1802,6 +1852,18 @@ export declare function client(t: Transport): {
|
|
|
1802
1852
|
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1803
1853
|
signal?: AbortSignal;
|
|
1804
1854
|
}): Promise<Reply<204, undefined>>;
|
|
1855
|
+
/**
|
|
1856
|
+
* Change a conversation, or make it read-only
|
|
1857
|
+
*
|
|
1858
|
+
* The project's server changes a conversation as its admins may — a group's title, description, picture, timer and policies; a direct conversation's timer and vanish mode — and makes it read-only, or writable again: its people read what was said in it, nobody writes in it (no message, reaction, edit, file, or change to its details), while the server still may (POST …/messages). Each change is told in the conversation, as a message of the platform's.
|
|
1859
|
+
*/
|
|
1860
|
+
adminUpdateConversation(input: {
|
|
1861
|
+
path: {
|
|
1862
|
+
conversation_id: string;
|
|
1863
|
+
};
|
|
1864
|
+
body: AdminUpdateConversation; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1865
|
+
signal?: AbortSignal;
|
|
1866
|
+
}): Promise<Reply<200, Conversation>>;
|
|
1805
1867
|
/**
|
|
1806
1868
|
* Add people to a group
|
|
1807
1869
|
*
|
|
@@ -1881,7 +1943,7 @@ export declare function client(t: Transport): {
|
|
|
1881
1943
|
/**
|
|
1882
1944
|
* A person's name and picture
|
|
1883
1945
|
*
|
|
1884
|
-
* The project's server names a person and gives their picture, as its own records say.
|
|
1946
|
+
* The project's server names a person and gives their picture, as its own records say. A person whose account was deleted is not given one again (`409 user_deleted`): a sync racing the deletion does not bring them back.
|
|
1885
1947
|
*/
|
|
1886
1948
|
adminPutProfile(input: {
|
|
1887
1949
|
path: {
|