palbase 0.14.1 → 0.15.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/{VSB66HSU.js → 2JWJOZWB.js} +2 -2
- package/dist/chunks/{S6HM2J7J.js → 2L6YDPYE.js} +2 -2
- package/dist/chunks/{2PCIM4VH.js → 332N2H2L.js} +1 -1
- package/dist/chunks/{NVA3C3Z3.js → 3HYGK4KK.js} +1 -1
- package/dist/chunks/{YYLNEVUC.js → 75SLRGIK.js} +2 -2
- package/dist/chunks/{O2LHK2GF.js → AA6WRVYF.js} +2 -2
- package/dist/chunks/{UXURIXBA.js → CBY3JE3R.js} +1 -1
- package/dist/chunks/{RBDGMOJT.js → DMMWR4G3.js} +2 -2
- package/dist/chunks/EELNNURM.js +2 -0
- package/dist/chunks/{3CUWIZU2.js → ETHKSFKR.js} +1 -1
- package/dist/chunks/{2CR3IN7R.js → EVTELMRJ.js} +2 -2
- package/dist/chunks/{RZBBS4OL.js → H7K75EKZ.js} +2 -2
- package/dist/chunks/{IXOQ6JI5.js → HEBADNJM.js} +1 -1
- package/dist/chunks/{7UQMB3JW.js → HIVD246W.js} +1 -1
- package/dist/chunks/HOZL4MMJ.js +18 -0
- package/dist/chunks/{URK5PA2R.js → KMZHLMVV.js} +2 -2
- package/dist/chunks/{YIFQY4BF.js → KPZDHOOU.js} +2 -2
- package/dist/chunks/{XCY7TFJH.js → ONG4Z7RY.js} +2 -2
- package/dist/chunks/PTXC4F7L.js +2 -0
- package/dist/chunks/{KLEVI5C3.js → RXQNOOVQ.js} +2 -2
- package/dist/chunks/{EH4ZWZCT.js → TRTI7CUE.js} +2 -2
- package/dist/chunks/U6JA755C.js +2 -0
- package/dist/chunks/{FZB357V4.js → Y6Q6WCB6.js} +1 -1
- package/dist/cli.js +112 -112
- package/dist/refuse/ai.js +1 -1
- package/dist/refuse/backend.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/ai/src/ai.d.ts +18 -1
- package/types/ai/src/chats.d.ts +13 -2
- package/types/ai/src/index.d.ts +1 -1
- package/types/internal/src/modules/ai.d.ts +69 -8
- package/types/internal/src/modules/analytics.d.ts +6 -2
- package/types/internal/src/modules/journeys.d.ts +45 -0
- package/types/internal/src/modules/secrets.d.ts +1 -1
- package/types/internal/src/modules/stores.d.ts +57 -0
- package/types/server/src/transit.d.ts +8 -1
- package/dist/chunks/GHEORI3H.js +0 -2
- package/dist/chunks/LND5DXD3.js +0 -18
- package/dist/chunks/VLNIDQ36.js +0 -2
- package/dist/chunks/WZLLB24Q.js +0 -2
package/dist/refuse/ai.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! palbase 0.
|
|
1
|
+
/*! palbase 0.15.0 — Palbase SDK License (see LICENSE) */
|
|
2
2
|
throw new Error("palbase/ai is for servers: it speaks with the project secret key, which never goes into a browser or a mobile app \u2014 call your backend, and let it ask the model");
|
package/dist/refuse/backend.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! palbase 0.
|
|
1
|
+
/*! palbase 0.15.0 — Palbase SDK License (see LICENSE) */
|
|
2
2
|
throw new Error("palbase/backend is a server framework: it runs on your backend, never in a browser or a mobile app \u2014 apps use palbase/web (or the native SDKs)");
|
package/dist/refuse/server.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! palbase 0.
|
|
1
|
+
/*! palbase 0.15.0 — Palbase SDK License (see LICENSE) */
|
|
2
2
|
throw new Error("palbase/server is for servers: its secret key never goes into a browser or a mobile app \u2014 apps use palbase/web (or the native SDKs) with the publishable key");
|
package/dist/server/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! palbase 0.
|
|
2
|
-
import{a as e,b as f,c as g,d as h,e as i,f as j,g as k,h as l,i as m,j as n,k as o,l as p,m as q,n as r,o as s,p as t,q as u,r as v,s as w,t as x,u as y}from"../chunks/
|
|
1
|
+
/*! palbase 0.15.0 — Palbase SDK License (see LICENSE) */
|
|
2
|
+
import{a as e,b as f,c as g,d as h,e as i,f as j,g as k,h as l,i as m,j as n,k as o,l as p,m as q,n as r,o as s,p as t,q as u,r as v,s as w,t as x,u as y}from"../chunks/U6JA755C.js";import{a as c,b as d}from"../chunks/HIVD246W.js";import"../chunks/CBY3JE3R.js";import"../chunks/ETHKSFKR.js";import{m as b}from"../chunks/PTXC4F7L.js";import"../chunks/KMZHLMVV.js";import{b as a}from"../chunks/DMMWR4G3.js";import"../chunks/332N2H2L.js";import"../chunks/Y6Q6WCB6.js";export{o as AuthUnavailable,b as EVENT_TYPES,c as FieldError,d as Fields,a as PalbaseError,t as ReservationSettled,n as TokenError,q as TokenVerifier,f as Transit,e as TransitRefusal,g as TransitRequest,i as WebhookSignatureError,h as createServer,s as isEntitled,y as loadSecrets,v as pages,x as platformOwn,w as processOwn,r as requestAddress,p as sessionStanding,l as signatureHeader,k as verifySignature,j as verifyWebhook,m as verifyWebhookRequest,u as withReservation};
|
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.15.0 — Palbase SDK License (see LICENSE) */
|
|
2
|
+
import{a,b,c,d,e}from"../chunks/RXQNOOVQ.js";import"../chunks/HIVD246W.js";import"../chunks/332N2H2L.js";import"../chunks/Y6Q6WCB6.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 M,b as j,c as q,d as G,e as N,f as U,g as D,h as H,i as J,j as B,k as F,l as K,m as W,n as X,o as Y,p as Z,q as ee}from"../chunks/
|
|
1
|
+
/*! palbase 0.15.0 — Palbase SDK License (see LICENSE) */
|
|
2
|
+
import{a as M,b as j,c as q,d as G,e as N,f as U,g as D,h as H,i as J,j as B,k as F,l as K,m as W,n as X,o as Y,p as Z,q as ee}from"../chunks/H7K75EKZ.js";import{a as _,b as Q,f as z}from"../chunks/ONG4Z7RY.js";import"../chunks/2JWJOZWB.js";import"../chunks/75SLRGIK.js";import"../chunks/3HYGK4KK.js";import{b as E,c as T,d as x,f as O,g as A,j as R,k as $,l as V,m as v,o as S}from"../chunks/CBY3JE3R.js";import"../chunks/EELNNURM.js";import"../chunks/PTXC4F7L.js";import"../chunks/KMZHLMVV.js";import{b as L}from"../chunks/DMMWR4G3.js";import"../chunks/332N2H2L.js";import"../chunks/Y6Q6WCB6.js";var te="oai-events";async function ne(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??se(),t=e.signal;t?.throwIfAborted();let f=e.audio??ae(),l=e.microphone===void 0,c=e.microphone??await r.getUserMedia({audio:!0});if(t?.aborted){if(l)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(),l)for(let n of c.getTracks())n.stop();f.srcObject!==null&&(f.srcObject=null)}};o.addEventListener("track",n=>{f.srcObject=n.streams[0]??new MediaStream([n.track]),f.play?.()?.catch?.(()=>{})}),o.addEventListener("connectionstatechange",()=>e.onState?.(o.connectionState));for(let n of c.getAudioTracks())o.addTrack(n,c);let m=o.createDataChannel(te);m.addEventListener("message",n=>{let p=oe(n.data);p!==void 0&&e.onError?.(p)});let d=()=>u();t?.addEventListener("abort",d,{once:!0});try{await o.setLocalDescription(await o.createOffer()),t?.throwIfAborted(),await re(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);if(t?.throwIfAborted(),typeof p?.id!="string"||p.id===""||typeof p.sdp!="string"||p.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:p.sdp}),t?.removeEventListener("abort",d),{id:p.id,peer:o,audio:f,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",d),u(),t?.aborted?t.reason:n}}function re(e,r,t){return e.iceGatheringState==="complete"?Promise.resolve():t?.aborted?Promise.reject(t.reason):new Promise((f,l)=>{let c=()=>{clearTimeout(u),e.removeEventListener("icegatheringstatechange",o),t?.removeEventListener("abort",s)},o=()=>{e.iceGatheringState==="complete"&&(c(),f())},s=()=>{c(),l(t?.reason)},u=setTimeout(()=>{c(),l(new Error(`connectVoice: the network candidates were not gathered in ${r} ms`))},r);e.addEventListener("icegatheringstatechange",o),t?.addEventListener("abort",s,{once:!0})})}function oe(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 se(){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 ae(){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 f=i(i(i(e)?.components)?.schemas)??{},l=(d,n)=>{let p=new Set,h=(C,g,y)=>{let a=i(C);if(!a)return;if(typeof a.$ref=="string"){if(y.has(a.$ref)||!a.$ref.startsWith("#/components/schemas/"))return;h(f[a.$ref.slice(21)],g,new Set(y).add(a.$ref));return}if(a[E]===!0){p.add(g);return}for(let b of["anyOf","oneOf","allOf"]){let k=a[b];if(Array.isArray(k))for(let I of k)h(I,g,y)}let P=i(a.properties);if(P)for(let[b,k]of Object.entries(P))h(k,`${g}/${v(b)}`,y);i(a.items)&&h(a.items,`${g}/*`,y);for(let b of["additionalProperties","patternProperties","prefixItems"])if(a[b]!==void 0&&w(a[b],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=(C,g)=>{if(Array.isArray(C))return C.some(a=>w(a,g));let y=i(C);return y?y[E]===!0?!0:typeof y.$ref=="string"&&!g.has(y.$ref)&&y.$ref.startsWith("#/components/schemas/")?(g.add(y.$ref),w(f[y.$ref.slice(21)],g)):Object.values(y).some(a=>typeof a=="object"&&a!==null&&w(a,g)):!1};return h(d,n,new Set),[...p]},c=d=>i(i(i(d)?.["application/json"])?.schema),o=[];o.push(...l(c(i(r.requestBody)?.content),"/body"));for(let d of Array.isArray(r.parameters)?r.parameters:[]){let n=i(d);if(!n)continue;let p=l(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(d=>/^2\d\d$/.test(d)).sort((d,n)=>d==="200"?-1:n==="200"?1:d.localeCompare(n)),m=u.length>0?l(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 ce(e){let r=`${e.method.toUpperCase()} ${e.path}`,t=i(i(i(i(e.contract)?.paths)?.[e.path])?.[e.method.toLowerCase()]),f=t?ie(e.contract,t,r):void 0;if(!f)return{body:e.body,query:e.query,open:async s=>s};let{key:l,header:c}=await A(e.key.kid,x(e.key.publicKey),O(e.projectId,e.method,e.path,e.params??[])),o=(s,u)=>s==null?s:S(s,u,f.request,(m,d)=>R(l,m,d));return{header:c,body:await o(e.body,"/body"),query:await o(e.query,"/query"),open:s=>s===void 0?Promise.resolve(s):S(s,"/response",f.response,async(u,m)=>{if(!$(m))throw new T("unopenable",`${r}: ${u} came plain where the contract says it is encrypted`);return V(l,u,m)})}}export{D as Analytics,_ as BackendError,G as Channel,H as Consent,Z as Flags,z as GatewayError,F as InApp,J as Inbox,U as Installation,W as Notify,L as PalbaseError,X as Purchases,N as RealtimeSocket,B as SESSION_START,M as SessionChangedError,K as WebPush,ne as connectVoice,ee as createClient,ce as encryptedCall,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.15.0 — Palbase SDK License (see LICENSE) */
|
|
2
|
+
import{a as i}from"../chunks/75SLRGIK.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/3HYGK4KK.js";import"../chunks/Y6Q6WCB6.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.15.0 — Palbase SDK License (see LICENSE) */
|
|
2
|
+
import{c as e,d as r,i as t}from"../chunks/ONG4Z7RY.js";import"../chunks/CBY3JE3R.js";import"../chunks/EELNNURM.js";import"../chunks/KMZHLMVV.js";import"../chunks/DMMWR4G3.js";import"../chunks/332N2H2L.js";import"../chunks/Y6Q6WCB6.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.15.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/2JWJOZWB.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/3HYGK4KK.js";import"../chunks/DMMWR4G3.js";import"../chunks/332N2H2L.js";import"../chunks/Y6Q6WCB6.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.15.0 — Palbase SDK License (see LICENSE) */
|
|
2
2
|
"use strict";(()=>{function f(e,s){if(e)try{let i=new URL(e,s);if(i.protocol==="https:"||i.protocol==="http:"&&(i.hostname==="localhost"||i.hostname==="127.0.0.1"))return i.href}catch{}}function g(e){let s=new URL(e.location.href).searchParams,i=s.get("url")??"",l=s.get("key")??"",r=(n,t)=>!n||!i?Promise.resolve():e.fetch(`${i.replace(/\/$/,"")}/notify/receipts`,{method:"POST",headers:{"content-type":"application/json",apikey:l},body:JSON.stringify({receipts:[{receipt:n,status:t}]}),keepalive:!0}).catch(()=>{}),a=async(n,t)=>{for(let o of await e.clients.matchAll({type:"window",includeUncontrolled:!0}))o.postMessage({type:"palbase.push",event:n,url:t.url,data:t.data})};e.addEventListener("push",(n=>{let t={};try{t=n.data?.json()??{}}catch{}let o={url:t.url,receipt:t.receipt,data:t.data};n.waitUntil(e.registration.showNotification(t.title??"",{body:t.body,image:t.image,tag:t.tag,data:o}).then(()=>Promise.all([r(t.receipt,"delivered"),a("received",o)])))})),e.addEventListener("notificationclick",(n=>{n.notification.close();let t=n.notification.data??{},o=f(t.url,e.location.origin),c=async()=>{if(!o)return;let d=(await e.clients.matchAll({type:"window",includeUncontrolled:!0})).find(u=>u.url===o);d?await d.focus():await e.clients.openWindow(o)};n.waitUntil(Promise.all([r(t.receipt,"opened"),c(),a("opened",t)]))})),e.addEventListener("notificationclose",(n=>{n.waitUntil(r(n.notification.data?.receipt,"dismissed"))}))}typeof self<"u"&&typeof self.registration=="object"&&!("document"in self)&&g(self);})();
|
package/dist/web/ssr.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! palbase 0.
|
|
2
|
-
import{q as f}from"../chunks/
|
|
1
|
+
/*! palbase 0.15.0 — Palbase SDK License (see LICENSE) */
|
|
2
|
+
import{q as f}from"../chunks/H7K75EKZ.js";import"../chunks/ONG4Z7RY.js";import"../chunks/2JWJOZWB.js";import"../chunks/75SLRGIK.js";import"../chunks/3HYGK4KK.js";import"../chunks/CBY3JE3R.js";import"../chunks/EELNNURM.js";import"../chunks/PTXC4F7L.js";import"../chunks/KMZHLMVV.js";import"../chunks/DMMWR4G3.js";import"../chunks/332N2H2L.js";import"../chunks/Y6Q6WCB6.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.15.0 — Palbase SDK License (see LICENSE) */
|
|
2
|
+
import"../chunks/Y6Q6WCB6.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.15.0",
|
|
4
4
|
"description": "Palbase for JavaScript: the web client (palbase/web), the server SDK (palbase/server), 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",
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
"dependencies": {
|
|
136
136
|
"@types/node": "26.6.4",
|
|
137
137
|
"bun-types": "1.4.2",
|
|
138
|
-
"palgres": "0.
|
|
138
|
+
"palgres": "0.15.0",
|
|
139
139
|
"reflect-metadata": "^0.2.2",
|
|
140
140
|
"typescript": "~6.0.3",
|
|
141
141
|
"zod": "^4.6.5"
|
package/types/ai/src/ai.d.ts
CHANGED
|
@@ -7,6 +7,12 @@ import { type AgentContext, type BackendAgent, type BackendAgentOptions, type Ba
|
|
|
7
7
|
type Module = ReturnType<typeof modules.ai.client>;
|
|
8
8
|
export type Response = Awaited<ReturnType<Module['getResponse']>>['data'];
|
|
9
9
|
export type Usage = Awaited<ReturnType<Module['listUsage']>>['data']['usage'][number];
|
|
10
|
+
/**
|
|
11
|
+
* What the project's use of Palbase's models (the platform's provider keys) cost this month, and what it may still
|
|
12
|
+
* spend: the free dollar a month brings and what is left of it, the monthly budget, and whether they serve the
|
|
13
|
+
* project now — and if not, why (reason).
|
|
14
|
+
*/
|
|
15
|
+
export type Spend = modules.ai.Spend;
|
|
10
16
|
export type Models = modules.ai.Models;
|
|
11
17
|
/** A text model a turn may name, as the engine's catalogue says it (ai.models().chat). */
|
|
12
18
|
export type ChatModel = modules.ai.ChatModel;
|
|
@@ -224,7 +230,8 @@ export interface AI {
|
|
|
224
230
|
/**
|
|
225
231
|
* Uses of models and their cost, newest first. Each carries its labels (metadata): its caller's — and a chat's turn
|
|
226
232
|
* the chat's labels and the chat (chat). With metadata, only the uses that carry every one of those labels: a
|
|
227
|
-
* product's spend, a task's — a deleted chat's too.
|
|
233
|
+
* product's spend, a task's — a deleted chat's too. A use whose tokens are in part an estimate says so (estimated):
|
|
234
|
+
* a reasoning call cut before its answer, whose hidden thinking its provider never counted.
|
|
228
235
|
*/
|
|
229
236
|
usage(options?: {
|
|
230
237
|
kind?: 'text' | 'embedding' | 'image';
|
|
@@ -235,6 +242,16 @@ export interface AI {
|
|
|
235
242
|
usage: Usage[];
|
|
236
243
|
nextCursor?: string;
|
|
237
244
|
}>;
|
|
245
|
+
/**
|
|
246
|
+
* The month's spend on Palbase's models (the platform's provider keys) at what it is billed, the free dollar a
|
|
247
|
+
* month brings and what is left of it (a Free project's), the monthly budget, and whether they serve the project
|
|
248
|
+
* now (platform_keys) — when not, why: its budget is spent (budget) or its free dollar is, with no balance to pay
|
|
249
|
+
* (payment). A call to them is then refused (402 ai_budget_reached, ai_payment_required) unless the project
|
|
250
|
+
* connected its own key for the model's provider (connectProvider), which its provider bills.
|
|
251
|
+
*/
|
|
252
|
+
spend(options?: {
|
|
253
|
+
signal?: AbortSignal;
|
|
254
|
+
}): Promise<Spend>;
|
|
238
255
|
/** Calls go out with the project's own provider key from now on. */
|
|
239
256
|
connectProvider(provider: string, key: string): Promise<{
|
|
240
257
|
name: string;
|
package/types/ai/src/chats.d.ts
CHANGED
|
@@ -31,6 +31,14 @@ export interface AISettings {
|
|
|
31
31
|
historyLimitBytes: number | null;
|
|
32
32
|
/** How much it keeps now. */
|
|
33
33
|
historyBytes: number;
|
|
34
|
+
/**
|
|
35
|
+
* The most the project spends a month on Palbase's models (the platform's provider keys), in US dollars at what it
|
|
36
|
+
* is billed; past it a call they would serve is refused (402 ai_budget_reached) until the month turns (UTC) or the
|
|
37
|
+
* budget is raised. null: none. Set by an owner or an admin of the organization, in Studio (AI › Settings) or with
|
|
38
|
+
* the CLI (palbase ai:settings:set --monthly-budget): what spends the money does not raise its own limit. The
|
|
39
|
+
* project's own provider keys are not counted: their provider bills them. ai.spend() says what is spent.
|
|
40
|
+
*/
|
|
41
|
+
monthlyBudgetUsd: number | null;
|
|
34
42
|
}
|
|
35
43
|
export interface EndpointInput {
|
|
36
44
|
/** https: a tool at that address, called with a signed POST; mcp: an MCP server (streamable HTTP). */
|
|
@@ -731,8 +739,11 @@ export interface Endpoints {
|
|
|
731
739
|
}
|
|
732
740
|
export interface Settings {
|
|
733
741
|
get(): Promise<AISettings>;
|
|
734
|
-
/**
|
|
735
|
-
|
|
742
|
+
/**
|
|
743
|
+
* A field left out is left as it is; the history kept may be lowered, not raised past the plan's, and
|
|
744
|
+
* historyLimitBytes null clears the project's own limit (the plan's is kept). The monthly budget is not set here:
|
|
745
|
+
* the platform refuses a key's request naming it (403) — an owner or an admin sets it in Studio or with the CLI.
|
|
746
|
+
*/
|
|
736
747
|
put(change: {
|
|
737
748
|
clients?: boolean;
|
|
738
749
|
userMessagesPerMinute?: number;
|
package/types/ai/src/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { createAI, AIResponseError } from './ai.js';
|
|
2
|
-
export type { AI, AIOptions, AgentGenerate, Ask, AskImage, AskTool, ChatModel, DeepPartial, Embed, Generate, ImageRequest, Images, Job, Message, Model, Models, ObjectStream, Picture, Response, Schema, TextStream, Uploader, Usage, } from './ai.js';
|
|
2
|
+
export type { AI, AIOptions, AgentGenerate, Ask, AskImage, AskTool, ChatModel, DeepPartial, Embed, Generate, ImageRequest, Images, Job, Message, Model, Models, ObjectStream, Picture, Response, Schema, Spend, TextStream, Uploader, Usage, } from './ai.js';
|
|
3
3
|
export { AISchemaError, prepare } from './schema.js';
|
|
4
4
|
export { ToolError } from './tools.js';
|
|
5
5
|
export type { Infer, StandardSchema } from './schema.js';
|
|
@@ -52,13 +52,9 @@ export type Agent = {
|
|
|
52
52
|
updated_by?: string;
|
|
53
53
|
};
|
|
54
54
|
/**
|
|
55
|
-
* What an agent is: its instructions, model, tools and subagents, and the shape of its one-shot answers
|
|
55
|
+
* What an agent is: its instructions, model, tools and subagents, and the shape of its one-shot answers.
|
|
56
56
|
*/
|
|
57
57
|
export type AgentDefinition = {
|
|
58
|
-
/**
|
|
59
|
-
* The project's machine that defines the agent at each turn.
|
|
60
|
-
*/
|
|
61
|
-
backend?: string;
|
|
62
58
|
/**
|
|
63
59
|
* The window, in tokens, the turn works in (the model's standard one unless said; more is billed as its provider bills it — GET /ai/models, context_window and max_input_tokens).
|
|
64
60
|
*/
|
|
@@ -1779,6 +1775,10 @@ export type Settings = {
|
|
|
1779
1775
|
* How much chat history the project keeps; a message past it is refused (history_full) until chats are deleted. A free project keeps 500 MiB at most; null: no fixed limit — a project with paid rights keeps all of it, paid by use, unless it says a limit of its own.
|
|
1780
1776
|
*/
|
|
1781
1777
|
history_limit_bytes: number | null;
|
|
1778
|
+
/**
|
|
1779
|
+
* The most the project spends a month on Palbase's models (the platform's provider keys), in US dollars at what it is billed; past it a call they would serve is refused (402 ai_budget_reached) until the month turns (UTC) or the budget is raised, and the organization's owners are emailed once. null: none. The project's own provider keys are not counted: their provider bills them.
|
|
1780
|
+
*/
|
|
1781
|
+
monthly_budget_usd: number | null;
|
|
1782
1782
|
/**
|
|
1783
1783
|
* How many messages one user sends a minute (default 20).
|
|
1784
1784
|
*/
|
|
@@ -1796,11 +1796,60 @@ export type SettingsRequest = {
|
|
|
1796
1796
|
* A limit of the project's own: a free project at most the plan's 500 MiB (it may keep less, not more), a project with paid rights at most 1 TiB. null clears it: the plan's is kept (free: 500 MiB; with paid rights: none).
|
|
1797
1797
|
*/
|
|
1798
1798
|
history_limit_bytes?: number | null;
|
|
1799
|
+
/**
|
|
1800
|
+
* A monthly budget for Palbase's models, in US dollars (cents at most): 0.01 to 1000000. null takes it away. Set by an owner or an admin of the project's organization, in Studio or with the CLI; a key's or a token's request naming it is refused (403): what spends the money does not raise its own limit.
|
|
1801
|
+
*/
|
|
1802
|
+
monthly_budget_usd?: number | null;
|
|
1799
1803
|
/**
|
|
1800
1804
|
* 1 to 600.
|
|
1801
1805
|
*/
|
|
1802
1806
|
user_messages_per_minute?: number;
|
|
1803
1807
|
};
|
|
1808
|
+
/**
|
|
1809
|
+
* What the project's use of Palbase's models (the platform's provider keys) has cost this month, and what it may still spend. A month brings a dollar of it free: a Free project's own, a paying account's once for all its projects. Past it a Free project uses its own provider keys; a Pay as you go one pays from its balance, at the provider's price and 10%.
|
|
1810
|
+
*/
|
|
1811
|
+
export type Spend = {
|
|
1812
|
+
/**
|
|
1813
|
+
* What is left of a Free project's free dollar this month; null on a paying one (its account's free dollar is its bill's).
|
|
1814
|
+
*/
|
|
1815
|
+
free_left_usd: number | null;
|
|
1816
|
+
/**
|
|
1817
|
+
* Whose the free dollar is: the project's own (project) or its account's, all its projects together (account).
|
|
1818
|
+
*/
|
|
1819
|
+
free_scope: "project" | "account";
|
|
1820
|
+
/**
|
|
1821
|
+
* The month's free use of Palbase's models, in US dollars.
|
|
1822
|
+
*/
|
|
1823
|
+
free_usd: number;
|
|
1824
|
+
/**
|
|
1825
|
+
* The month (UTC, YYYY-MM).
|
|
1826
|
+
*/
|
|
1827
|
+
month: string;
|
|
1828
|
+
/**
|
|
1829
|
+
* The budget the project's owners set (null: none).
|
|
1830
|
+
*/
|
|
1831
|
+
monthly_budget_usd: number | null;
|
|
1832
|
+
/**
|
|
1833
|
+
* free (no paid rights: its free dollar, then its own keys), pay_as_you_go (its account's balance pays past the free dollar) or exempt (measured, not charged).
|
|
1834
|
+
*/
|
|
1835
|
+
plan: "free" | "pay_as_you_go" | "exempt";
|
|
1836
|
+
/**
|
|
1837
|
+
* Whether Palbase's models serve the project now. When not, a call to them is refused (402) unless the project connected its own key for the model's provider.
|
|
1838
|
+
*/
|
|
1839
|
+
platform_keys: boolean;
|
|
1840
|
+
/**
|
|
1841
|
+
* Why Palbase's models serve it no more this month: budget (its monthly budget is spent) or payment (its free dollar is spent and it has no payment account with a balance).
|
|
1842
|
+
*/
|
|
1843
|
+
reason?: "budget" | "payment";
|
|
1844
|
+
/**
|
|
1845
|
+
* The day the month's free dollar and budget start again (UTC, YYYY-MM-DD).
|
|
1846
|
+
*/
|
|
1847
|
+
resets_on: string;
|
|
1848
|
+
/**
|
|
1849
|
+
* The month's use of Palbase's models, in US dollars at what it is billed (the provider's price and 10%), before the free dollar is taken off.
|
|
1850
|
+
*/
|
|
1851
|
+
spent_usd: number;
|
|
1852
|
+
};
|
|
1804
1853
|
/**
|
|
1805
1854
|
* The turn a stop stopped.
|
|
1806
1855
|
*/
|
|
@@ -2203,6 +2252,10 @@ export type Use = {
|
|
|
2203
2252
|
* When.
|
|
2204
2253
|
*/
|
|
2205
2254
|
created_at: string;
|
|
2255
|
+
/**
|
|
2256
|
+
* Its tokens are in part an estimate: a reasoning call cut before its answer, whose provider never said what its hidden thinking came to, billed as the time the model thought at its measured speed, rounded down.
|
|
2257
|
+
*/
|
|
2258
|
+
estimated: boolean;
|
|
2206
2259
|
/**
|
|
2207
2260
|
* The use's id.
|
|
2208
2261
|
*/
|
|
@@ -2612,7 +2665,7 @@ export declare function client(t: Transport): {
|
|
|
2612
2665
|
/**
|
|
2613
2666
|
* Save an agent's draft
|
|
2614
2667
|
*
|
|
2615
|
-
* Saves the draft of an agent the project keeps — a new one's first. What its chats talk to changes only once the draft is published. revision names the draft the change was made to: when another was saved since, it is refused (409 draft_changed) and nothing is lost; left out, the last save wins. A name its backend's build defines is refused (409 agent_defined_in_code): that agent is changed in the code.
|
|
2668
|
+
* Saves the draft of an agent the project keeps — a new one's first. What its chats talk to changes only once the draft is published. revision names the draft the change was made to: when another was saved since, it is refused (409 draft_changed) and nothing is lost; left out, the last save wins. A name its backend's build defines is refused (409 agent_defined_in_code): that agent is changed in the code.
|
|
2616
2669
|
*/
|
|
2617
2670
|
putAgent(input: {
|
|
2618
2671
|
path: {
|
|
@@ -2627,7 +2680,7 @@ export declare function client(t: Transport): {
|
|
|
2627
2680
|
/**
|
|
2628
2681
|
* Forget an agent
|
|
2629
2682
|
*
|
|
2630
|
-
* An agent the project keeps, its versions with it — an agent made again under its name numbers its versions after them, and a chat on one of them is told it is gone
|
|
2683
|
+
* An agent the project keeps, its versions with it — an agent made again under its name numbers its versions after them, and a chat on one of them is told it is gone. Its chats stay; a message to one of them is refused (agent_not_found) until an agent of that name is there again. One its backend's build declares goes with the code (409 agent_defined_in_code).
|
|
2631
2684
|
*/
|
|
2632
2685
|
deleteAgent(input: {
|
|
2633
2686
|
path: {
|
|
@@ -3306,12 +3359,20 @@ export declare function client(t: Transport): {
|
|
|
3306
3359
|
/**
|
|
3307
3360
|
* Change what the project allows its chats
|
|
3308
3361
|
*
|
|
3309
|
-
* A field left out is left as it is. The history kept may be lowered, not raised past the plan's.
|
|
3362
|
+
* A field left out is left as it is. The history kept may be lowered, not raised past the plan's. A monthly budget is kept by Palbase's billing: on a stack that bills no AI it is refused (409 no_billing).
|
|
3310
3363
|
*/
|
|
3311
3364
|
putSettings(input: {
|
|
3312
3365
|
body: SettingsRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
3313
3366
|
signal?: AbortSignal;
|
|
3314
3367
|
}): Promise<Reply<200, Settings>>;
|
|
3368
|
+
/**
|
|
3369
|
+
* What the project's AI on Palbase's models costs this month
|
|
3370
|
+
*
|
|
3371
|
+
* The month's spend on Palbase's models at what it is billed, the free dollar a month brings and what is left of it, the monthly budget, and whether Palbase's models serve the project now — and if not, why.
|
|
3372
|
+
*/
|
|
3373
|
+
getSpend(input?: {
|
|
3374
|
+
signal?: AbortSignal;
|
|
3375
|
+
}): Promise<Reply<200, Spend>>;
|
|
3315
3376
|
/**
|
|
3316
3377
|
* The tools an agent may be given
|
|
3317
3378
|
*
|
|
@@ -298,9 +298,9 @@ export type CaptureRequest = {
|
|
|
298
298
|
*/
|
|
299
299
|
app_version?: string;
|
|
300
300
|
/**
|
|
301
|
-
* Who did it (256 characters at most). With a user's token, the user's id instead.
|
|
301
|
+
* Who did it (256 characters at most). With a user's token, the user's id instead; with user_id, the user's id. Required unless user_id names the user.
|
|
302
302
|
*/
|
|
303
|
-
distinct_id
|
|
303
|
+
distinct_id?: string;
|
|
304
304
|
/**
|
|
305
305
|
* The event's name: a letter or $, then letters, digits and _.:-$; 64 at most.
|
|
306
306
|
*/
|
|
@@ -323,6 +323,10 @@ export type CaptureRequest = {
|
|
|
323
323
|
* Unix milliseconds on the device's clock.
|
|
324
324
|
*/
|
|
325
325
|
timestamp?: number;
|
|
326
|
+
/**
|
|
327
|
+
* The user whose event it is: the project's server alone names one (its secret key) — their own event, as their app sends it signed in, on their timeline and acted on by their journeys. An app's event is its signed-in user's; one that names user_id is refused (invalid_user_id).
|
|
328
|
+
*/
|
|
329
|
+
user_id?: string;
|
|
326
330
|
};
|
|
327
331
|
/**
|
|
328
332
|
* Every event a project's timelines can hold: the platform modules', and those its apps and backend sent in the window.
|
|
@@ -402,6 +402,10 @@ export type JourneyConvertedEvent = {
|
|
|
402
402
|
* The run's id
|
|
403
403
|
*/
|
|
404
404
|
run_id: string;
|
|
405
|
+
/**
|
|
406
|
+
* A test user's run (POST /journeys/{key}/test); absent on a person's
|
|
407
|
+
*/
|
|
408
|
+
test?: boolean;
|
|
405
409
|
/**
|
|
406
410
|
* The person
|
|
407
411
|
*/
|
|
@@ -427,6 +431,10 @@ export type JourneyEndedEvent = {
|
|
|
427
431
|
* The run's id
|
|
428
432
|
*/
|
|
429
433
|
run_id: string;
|
|
434
|
+
/**
|
|
435
|
+
* A test user's run (POST /journeys/{key}/test); absent on a person's
|
|
436
|
+
*/
|
|
437
|
+
test?: boolean;
|
|
430
438
|
/**
|
|
431
439
|
* The person
|
|
432
440
|
*/
|
|
@@ -448,6 +456,10 @@ export type JourneyEnteredEvent = {
|
|
|
448
456
|
* The run's id
|
|
449
457
|
*/
|
|
450
458
|
run_id: string;
|
|
459
|
+
/**
|
|
460
|
+
* A test user's run (POST /journeys/{key}/test); absent on a person's
|
|
461
|
+
*/
|
|
462
|
+
test?: boolean;
|
|
451
463
|
/**
|
|
452
464
|
* The person
|
|
453
465
|
*/
|
|
@@ -483,6 +495,10 @@ export type JourneyEventEvent = {
|
|
|
483
495
|
* The step's id
|
|
484
496
|
*/
|
|
485
497
|
step: string;
|
|
498
|
+
/**
|
|
499
|
+
* A test user's run (POST /journeys/{key}/test); absent on a person's
|
|
500
|
+
*/
|
|
501
|
+
test?: boolean;
|
|
486
502
|
/**
|
|
487
503
|
* The person
|
|
488
504
|
*/
|
|
@@ -599,6 +615,10 @@ export type JourneyStepEvent = {
|
|
|
599
615
|
* The step's id
|
|
600
616
|
*/
|
|
601
617
|
step: string;
|
|
618
|
+
/**
|
|
619
|
+
* A test user's run (POST /journeys/{key}/test); absent on a person's
|
|
620
|
+
*/
|
|
621
|
+
test?: boolean;
|
|
602
622
|
/**
|
|
603
623
|
* The person
|
|
604
624
|
*/
|
|
@@ -759,6 +779,10 @@ export type Run = {
|
|
|
759
779
|
* The steps it took, in order
|
|
760
780
|
*/
|
|
761
781
|
steps: RunStep[];
|
|
782
|
+
/**
|
|
783
|
+
* A run tried on a test user (POST /journeys/{key}/test): its waits a minute long, counted in no report and no month's people
|
|
784
|
+
*/
|
|
785
|
+
test: boolean;
|
|
762
786
|
/**
|
|
763
787
|
* The person
|
|
764
788
|
*/
|
|
@@ -997,6 +1021,15 @@ export type StepStats = {
|
|
|
997
1021
|
*/
|
|
998
1022
|
step: string;
|
|
999
1023
|
};
|
|
1024
|
+
/**
|
|
1025
|
+
* The test user a journey is tried on.
|
|
1026
|
+
*/
|
|
1027
|
+
export type TestRunWrite = {
|
|
1028
|
+
/**
|
|
1029
|
+
* One of the project's test users (Auth › Test accounts)
|
|
1030
|
+
*/
|
|
1031
|
+
user_id: string;
|
|
1032
|
+
};
|
|
1000
1033
|
/**
|
|
1001
1034
|
* What a definition's check found.
|
|
1002
1035
|
*/
|
|
@@ -1219,5 +1252,17 @@ export declare function client(t: Transport): {
|
|
|
1219
1252
|
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1220
1253
|
signal?: AbortSignal;
|
|
1221
1254
|
}): Promise<Reply<200, Journey>>;
|
|
1255
|
+
/**
|
|
1256
|
+
* Try a journey on a test user
|
|
1257
|
+
*
|
|
1258
|
+
* Runs a journey — a draft too — for one of the project's test users (Auth › Test accounts), from its start, now: its messages are sent and its coupons given as a person's would be, but each wait lasts a minute, and the run is counted in no report and no month's people (its events carry test: true). A test run of the user's open in the journey ends first. Refused for a user who is no test user (422 not_a_test_user) and for a stopped journey (409 journey_stopped).
|
|
1259
|
+
*/
|
|
1260
|
+
testJourney(input: {
|
|
1261
|
+
path: {
|
|
1262
|
+
key: string;
|
|
1263
|
+
};
|
|
1264
|
+
body: TestRunWrite; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
1265
|
+
signal?: AbortSignal;
|
|
1266
|
+
}): Promise<Reply<201, Run>>;
|
|
1222
1267
|
};
|
|
1223
1268
|
export type Client = ReturnType<typeof client>;
|
|
@@ -349,7 +349,7 @@ export declare function client(t: Transport): {
|
|
|
349
349
|
query?: {
|
|
350
350
|
limit?: number; /** The next_cursor of the previous page. Opaque; omit it for the first page. */
|
|
351
351
|
cursor?: string; /** Only this environment's entries. */
|
|
352
|
-
environment?: "development" | "production"; /** Only this secret's entries. */
|
|
352
|
+
environment?: "development" | "production"; /** Only this secret's entries; this encrypted field's (its address: table.column, or schema.table.column); or this key's, a field key's (k2) or a transit key's (t2). */
|
|
353
353
|
name?: string;
|
|
354
354
|
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
355
355
|
signal?: AbortSignal;
|
|
@@ -501,6 +501,10 @@ export type AppleHealth = {
|
|
|
501
501
|
* Its App Store versions' terminations, hangs and launches.
|
|
502
502
|
*/
|
|
503
503
|
metrics: HealthMetric[];
|
|
504
|
+
/**
|
|
505
|
+
* The newest builds' TestFlight counts, newest first: what Apple counted of each from its upload, at most a year back.
|
|
506
|
+
*/
|
|
507
|
+
testflight_builds: TestFlightBuildUsage[];
|
|
504
508
|
/**
|
|
505
509
|
* The newest crashes testers sent from TestFlight (read one with its log: GET …/feedback/crash/{id}).
|
|
506
510
|
*/
|
|
@@ -2029,6 +2033,59 @@ export type SubmitRequest = {
|
|
|
2029
2033
|
*/
|
|
2030
2034
|
in_app_purchases?: string[];
|
|
2031
2035
|
};
|
|
2036
|
+
/**
|
|
2037
|
+
* What TestFlight counted of one of an iOS app's builds, as Apple keeps it.
|
|
2038
|
+
*/
|
|
2039
|
+
export type TestFlightBuildUsage = {
|
|
2040
|
+
/**
|
|
2041
|
+
* The build at App Store Connect.
|
|
2042
|
+
*/
|
|
2043
|
+
asc_build_id: string;
|
|
2044
|
+
/**
|
|
2045
|
+
* Its build number (CFBundleVersion).
|
|
2046
|
+
*/
|
|
2047
|
+
build_number: string;
|
|
2048
|
+
/**
|
|
2049
|
+
* Crashes on testers' devices.
|
|
2050
|
+
*/
|
|
2051
|
+
crashes: number;
|
|
2052
|
+
/**
|
|
2053
|
+
* Whether it expired in TestFlight.
|
|
2054
|
+
*/
|
|
2055
|
+
expired: boolean;
|
|
2056
|
+
/**
|
|
2057
|
+
* Feedback testers sent of it.
|
|
2058
|
+
*/
|
|
2059
|
+
feedback: number;
|
|
2060
|
+
/**
|
|
2061
|
+
* The first day Apple counted (absent while Apple keeps no counts of it).
|
|
2062
|
+
*/
|
|
2063
|
+
from?: string;
|
|
2064
|
+
/**
|
|
2065
|
+
* Installs by testers.
|
|
2066
|
+
*/
|
|
2067
|
+
installs: number;
|
|
2068
|
+
/**
|
|
2069
|
+
* Invitations it went out with.
|
|
2070
|
+
*/
|
|
2071
|
+
invites: number;
|
|
2072
|
+
/**
|
|
2073
|
+
* Sessions testers ran it.
|
|
2074
|
+
*/
|
|
2075
|
+
sessions: number;
|
|
2076
|
+
/**
|
|
2077
|
+
* The last day Apple counted.
|
|
2078
|
+
*/
|
|
2079
|
+
to?: string;
|
|
2080
|
+
/**
|
|
2081
|
+
* When it was uploaded.
|
|
2082
|
+
*/
|
|
2083
|
+
uploaded_at: string;
|
|
2084
|
+
/**
|
|
2085
|
+
* Its app version (CFBundleShortVersionString).
|
|
2086
|
+
*/
|
|
2087
|
+
version: string;
|
|
2088
|
+
};
|
|
2032
2089
|
/**
|
|
2033
2090
|
* A person to have in a group.
|
|
2034
2091
|
*/
|
|
@@ -32,11 +32,13 @@ export interface TransitOptions {
|
|
|
32
32
|
fetch: (signal?: AbortSignal) => Promise<TransitKeySet>;
|
|
33
33
|
/** The clock (tests). */
|
|
34
34
|
now?: () => number;
|
|
35
|
+
/** Waits ms on that clock (tests). */
|
|
36
|
+
sleep?: (ms: number) => Promise<void>;
|
|
35
37
|
}
|
|
36
38
|
/**
|
|
37
39
|
* The project's transit keys. `await load()` once at startup: requests are
|
|
38
40
|
* opened with the keys held, fetched again every minute and when a request
|
|
39
|
-
* names a key
|
|
41
|
+
* names a key newer than every one held.
|
|
40
42
|
*/
|
|
41
43
|
export declare class Transit {
|
|
42
44
|
private keys;
|
|
@@ -45,9 +47,12 @@ export declare class Transit {
|
|
|
45
47
|
private project;
|
|
46
48
|
private timer;
|
|
47
49
|
private fetchedAt;
|
|
50
|
+
/** When the fetch whose keys are held began. */
|
|
51
|
+
private heldFrom;
|
|
48
52
|
private fetching;
|
|
49
53
|
private readonly opts;
|
|
50
54
|
private readonly now;
|
|
55
|
+
private readonly sleep;
|
|
51
56
|
constructor(opts: TransitOptions);
|
|
52
57
|
/** Whether the keys are loaded. */
|
|
53
58
|
get loaded(): boolean;
|
|
@@ -60,6 +65,8 @@ export declare class Transit {
|
|
|
60
65
|
/** Stops the refresh. */
|
|
61
66
|
close(): void;
|
|
62
67
|
private refresh;
|
|
68
|
+
/** The newest key the project is known to have made, held or retired. */
|
|
69
|
+
private newest;
|
|
63
70
|
private key;
|
|
64
71
|
/**
|
|
65
72
|
* A request's key, from its Palbase-Encryption header: sealed for this
|