palbase 0.17.0 → 0.17.1
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/{55C2GHGA.js → 22M4UQVQ.js} +2 -2
- package/dist/chunks/{O6LRXDFY.js → 2PIDGENK.js} +2 -2
- package/dist/chunks/{CPQR6PSB.js → 3UVLEWTM.js} +1 -1
- package/dist/chunks/{25FDQIKY.js → 3Y4K6F6T.js} +2 -2
- package/dist/chunks/{KUTBWXNL.js → 6WGPEHCE.js} +1 -1
- package/dist/chunks/{6VLC4QJY.js → 7C7HACEZ.js} +2 -2
- package/dist/chunks/{K3KCYVMN.js → B2IIU37G.js} +1 -1
- package/dist/chunks/{V72PBUK4.js → CYLNEHKQ.js} +2 -2
- package/dist/chunks/{HPQSHDEH.js → DWRLUP7O.js} +2 -2
- package/dist/chunks/{6CEXEK2F.js → E27BZ5SM.js} +2 -2
- package/dist/chunks/{56S5CF3M.js → FWX3RGVS.js} +2 -2
- package/dist/chunks/{45DR7TF6.js → K23K6ZFG.js} +2 -2
- package/dist/chunks/{K2CN4CGB.js → KBDCHYSD.js} +1 -1
- package/dist/chunks/{ENZI5RN5.js → LAHIVWPV.js} +1 -1
- package/dist/chunks/{JGUQKVFH.js → LIKE2KDM.js} +2 -2
- package/dist/chunks/{WW4HVDSO.js → LR5ONXTF.js} +2 -2
- package/dist/chunks/{IG2INK7Z.js → NJFKRHS6.js} +2 -2
- package/dist/chunks/{KBO5NELQ.js → OER3S5NN.js} +2 -2
- package/dist/chunks/{4GIYAC3R.js → R7PRW7FG.js} +1 -1
- package/dist/chunks/{GL5Y2PAS.js → VXT46THA.js} +2 -2
- package/dist/chunks/{FQLY6TBH.js → XT3I7PG3.js} +2 -2
- package/dist/chunks/{MI5QEZ7Y.js → Y6NZV7LU.js} +1 -1
- package/dist/chunks/{XAHQAK65.js → ZSUSEU5H.js} +2 -2
- package/dist/cli.js +114 -113
- 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/internal/src/modules/purchases.d.ts +383 -0
package/dist/refuse/ai.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! palbase 0.17.
|
|
1
|
+
/*! palbase 0.17.1 — 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.17.
|
|
1
|
+
/*! palbase 0.17.1 — 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.17.
|
|
1
|
+
/*! palbase 0.17.1 — 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.17.
|
|
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.17.1 — 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/VXT46THA.js";import{a as c,b as d}from"../chunks/Y6NZV7LU.js";import"../chunks/LAHIVWPV.js";import"../chunks/B2IIU37G.js";import{m as b}from"../chunks/CYLNEHKQ.js";import"../chunks/DWRLUP7O.js";import{b as a}from"../chunks/3Y4K6F6T.js";import"../chunks/KBDCHYSD.js";import"../chunks/3UVLEWTM.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.17.
|
|
2
|
-
import{a,b,c,d,e}from"../chunks/
|
|
1
|
+
/*! palbase 0.17.1 — Palbase SDK License (see LICENSE) */
|
|
2
|
+
import{a,b,c,d,e}from"../chunks/22M4UQVQ.js";import"../chunks/Y6NZV7LU.js";import"../chunks/KBDCHYSD.js";import"../chunks/3UVLEWTM.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.17.
|
|
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.17.1 — 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/LIKE2KDM.js";import{a as _,b as Q,f as z}from"../chunks/FWX3RGVS.js";import"../chunks/7C7HACEZ.js";import"../chunks/E27BZ5SM.js";import"../chunks/R7PRW7FG.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/LAHIVWPV.js";import"../chunks/LR5ONXTF.js";import"../chunks/CYLNEHKQ.js";import"../chunks/DWRLUP7O.js";import{b as L}from"../chunks/3Y4K6F6T.js";import"../chunks/KBDCHYSD.js";import"../chunks/3UVLEWTM.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.17.
|
|
2
|
-
import{a as i}from"../chunks/
|
|
1
|
+
/*! palbase 0.17.1 — Palbase SDK License (see LICENSE) */
|
|
2
|
+
import{a as i}from"../chunks/E27BZ5SM.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/R7PRW7FG.js";import"../chunks/3UVLEWTM.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.17.
|
|
2
|
-
import{c as e,d as r,i as t}from"../chunks/
|
|
1
|
+
/*! palbase 0.17.1 — Palbase SDK License (see LICENSE) */
|
|
2
|
+
import{c as e,d as r,i as t}from"../chunks/FWX3RGVS.js";import"../chunks/LAHIVWPV.js";import"../chunks/LR5ONXTF.js";import"../chunks/DWRLUP7O.js";import"../chunks/3Y4K6F6T.js";import"../chunks/KBDCHYSD.js";import"../chunks/3UVLEWTM.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.17.
|
|
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.17.1 — 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/7C7HACEZ.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/R7PRW7FG.js";import"../chunks/3Y4K6F6T.js";import"../chunks/KBDCHYSD.js";import"../chunks/3UVLEWTM.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.17.
|
|
1
|
+
/*! palbase 0.17.1 — 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.17.
|
|
2
|
-
import{q as f}from"../chunks/
|
|
1
|
+
/*! palbase 0.17.1 — Palbase SDK License (see LICENSE) */
|
|
2
|
+
import{q as f}from"../chunks/LIKE2KDM.js";import"../chunks/FWX3RGVS.js";import"../chunks/7C7HACEZ.js";import"../chunks/E27BZ5SM.js";import"../chunks/R7PRW7FG.js";import"../chunks/LAHIVWPV.js";import"../chunks/LR5ONXTF.js";import"../chunks/CYLNEHKQ.js";import"../chunks/DWRLUP7O.js";import"../chunks/3Y4K6F6T.js";import"../chunks/KBDCHYSD.js";import"../chunks/3UVLEWTM.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.17.
|
|
2
|
-
import"../chunks/
|
|
1
|
+
/*! palbase 0.17.1 — Palbase SDK License (see LICENSE) */
|
|
2
|
+
import"../chunks/3UVLEWTM.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.17.
|
|
3
|
+
"version": "0.17.1",
|
|
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.17.
|
|
138
|
+
"palgres": "0.17.1",
|
|
139
139
|
"reflect-metadata": "^0.2.2",
|
|
140
140
|
"typescript": "~6.0.3",
|
|
141
141
|
"zod": "^4.6.5"
|
|
@@ -5937,6 +5937,314 @@ export type StoreID = {
|
|
|
5937
5937
|
*/
|
|
5938
5938
|
product: string;
|
|
5939
5939
|
};
|
|
5940
|
+
/**
|
|
5941
|
+
* A customer support found, and what found them.
|
|
5942
|
+
*/
|
|
5943
|
+
export type CustomerMatch = {
|
|
5944
|
+
/**
|
|
5945
|
+
* The customer; null for a purchase made on the web by no one yet (its link not redeemed).
|
|
5946
|
+
*/
|
|
5947
|
+
customer_id: string | null;
|
|
5948
|
+
/**
|
|
5949
|
+
* What found them: `customer_id`, an id a store gave the purchase or the buyer (`app_store`, `play_store`, `stripe`), or `email` (the address a buyer with no account gave at checkout).
|
|
5950
|
+
*/
|
|
5951
|
+
matched_by: "customer_id" | "app_store" | "play_store" | "stripe" | "email";
|
|
5952
|
+
/**
|
|
5953
|
+
* The purchase found, when one was.
|
|
5954
|
+
*/
|
|
5955
|
+
chain_id?: string;
|
|
5956
|
+
/**
|
|
5957
|
+
* The purchase's store.
|
|
5958
|
+
*/
|
|
5959
|
+
store?: "app_store" | "play_store" | "stripe";
|
|
5960
|
+
/**
|
|
5961
|
+
* The purchase's product, as the catalog names it.
|
|
5962
|
+
*/
|
|
5963
|
+
product?: string;
|
|
5964
|
+
/**
|
|
5965
|
+
* The purchase is the store's sandbox's.
|
|
5966
|
+
*/
|
|
5967
|
+
is_sandbox: boolean;
|
|
5968
|
+
/**
|
|
5969
|
+
* When the customer was first seen, or the purchase made.
|
|
5970
|
+
*/
|
|
5971
|
+
at: string;
|
|
5972
|
+
};
|
|
5973
|
+
/**
|
|
5974
|
+
* The customers a query found, the newest first (at most 50).
|
|
5975
|
+
*/
|
|
5976
|
+
export type CustomerSearch = {
|
|
5977
|
+
/**
|
|
5978
|
+
* The query, trimmed.
|
|
5979
|
+
*/
|
|
5980
|
+
query: string;
|
|
5981
|
+
customers: CustomerMatch[];
|
|
5982
|
+
};
|
|
5983
|
+
/**
|
|
5984
|
+
* A movement of a customer's credits.
|
|
5985
|
+
*/
|
|
5986
|
+
export type CreditMove = {
|
|
5987
|
+
/**
|
|
5988
|
+
* The credits' currency.
|
|
5989
|
+
*/
|
|
5990
|
+
currency: string;
|
|
5991
|
+
/**
|
|
5992
|
+
* What moved them.
|
|
5993
|
+
*/
|
|
5994
|
+
kind: "grant" | "revoke" | "unrevoke" | "expire" | "merge" | "forgive";
|
|
5995
|
+
/**
|
|
5996
|
+
* The change of the balance (negative: taken).
|
|
5997
|
+
*/
|
|
5998
|
+
delta: number;
|
|
5999
|
+
};
|
|
6000
|
+
/**
|
|
6001
|
+
* One thing that happened to a customer.
|
|
6002
|
+
*/
|
|
6003
|
+
export type CustomerEvent = {
|
|
6004
|
+
/**
|
|
6005
|
+
* When it happened, as the store or the module recorded it.
|
|
6006
|
+
*/
|
|
6007
|
+
at: string;
|
|
6008
|
+
/**
|
|
6009
|
+
* What happened: a payment (`purchase`, `renewal`), a `refund`, a subscription's renewal turned off (`cancellation`) or back on (`resumption`), a failed charge (`billing_issue`), its end (`expiration`), a grant given (`grant`) or taken back (`grant_revoked`), credits moved (`credits`), a purchase moved to (`transfer_in`) or from (`transfer_out`) the customer.
|
|
6010
|
+
*/
|
|
6011
|
+
kind: "purchase" | "renewal" | "refund" | "cancellation" | "resumption" | "billing_issue" | "expiration" | "grant" | "grant_revoked" | "credits" | "transfer_in" | "transfer_out";
|
|
6012
|
+
/**
|
|
6013
|
+
* The purchase's store.
|
|
6014
|
+
*/
|
|
6015
|
+
store?: "app_store" | "play_store" | "stripe";
|
|
6016
|
+
/**
|
|
6017
|
+
* The product, as the catalog names it.
|
|
6018
|
+
*/
|
|
6019
|
+
product?: string;
|
|
6020
|
+
/**
|
|
6021
|
+
* The product's plan, as the catalog names it.
|
|
6022
|
+
*/
|
|
6023
|
+
plan?: string;
|
|
6024
|
+
/**
|
|
6025
|
+
* The store's id of the product.
|
|
6026
|
+
*/
|
|
6027
|
+
store_product_id?: string;
|
|
6028
|
+
/**
|
|
6029
|
+
* The purchase is the store's sandbox's.
|
|
6030
|
+
*/
|
|
6031
|
+
is_sandbox: boolean;
|
|
6032
|
+
/**
|
|
6033
|
+
* What was paid — a refund: what was given back —, as the store said it, in millionths of `currency`.
|
|
6034
|
+
*/
|
|
6035
|
+
amount_micros?: number;
|
|
6036
|
+
/**
|
|
6037
|
+
* ISO 4217.
|
|
6038
|
+
*/
|
|
6039
|
+
currency?: string;
|
|
6040
|
+
/**
|
|
6041
|
+
* The record's why: a refund's kind (`refund`, `chargeback`, `family`, `other`), a grant's or a credit movement's reason, how a purchase moved (`restore`, `merge`, `assign`, `purchase`).
|
|
6042
|
+
*/
|
|
6043
|
+
reason?: string;
|
|
6044
|
+
/**
|
|
6045
|
+
* Who did it: `store` (the store, or the customer at it), `customer`, `project`, or the key or user that gave a grant or moved credits (`key:…`, `user:…`).
|
|
6046
|
+
*/
|
|
6047
|
+
actor: string;
|
|
6048
|
+
/**
|
|
6049
|
+
* The purchase.
|
|
6050
|
+
*/
|
|
6051
|
+
chain_id?: string;
|
|
6052
|
+
/**
|
|
6053
|
+
* The store's id of the transaction.
|
|
6054
|
+
*/
|
|
6055
|
+
transaction_id?: string;
|
|
6056
|
+
/**
|
|
6057
|
+
* The grant.
|
|
6058
|
+
*/
|
|
6059
|
+
grant_id?: string;
|
|
6060
|
+
/**
|
|
6061
|
+
* The grant's entitlement.
|
|
6062
|
+
*/
|
|
6063
|
+
entitlement?: string;
|
|
6064
|
+
credits?: CreditMove;
|
|
6065
|
+
/**
|
|
6066
|
+
* A transfer's other side: whom from, whom to (null: a purchase that was no one's).
|
|
6067
|
+
*/
|
|
6068
|
+
other_customer_id?: string | null;
|
|
6069
|
+
};
|
|
6070
|
+
/**
|
|
6071
|
+
* What happened to a customer, the newest first, a page at a time.
|
|
6072
|
+
*/
|
|
6073
|
+
export type CustomerHistory = {
|
|
6074
|
+
/**
|
|
6075
|
+
* The customer.
|
|
6076
|
+
*/
|
|
6077
|
+
customer_id: string;
|
|
6078
|
+
events: CustomerEvent[];
|
|
6079
|
+
/**
|
|
6080
|
+
* Goes on to the next page (send it as `cursor`); absent on the last page.
|
|
6081
|
+
*/
|
|
6082
|
+
next_cursor?: string;
|
|
6083
|
+
};
|
|
6084
|
+
/**
|
|
6085
|
+
* A grant as support reads it: active or not, and who took it back.
|
|
6086
|
+
*/
|
|
6087
|
+
export type GrantRecord = {
|
|
6088
|
+
/**
|
|
6089
|
+
* Its customer.
|
|
6090
|
+
*/
|
|
6091
|
+
customer_id: string;
|
|
6092
|
+
/**
|
|
6093
|
+
* The entitlement.
|
|
6094
|
+
*/
|
|
6095
|
+
entitlement: string;
|
|
6096
|
+
/**
|
|
6097
|
+
* When it ends; null for life.
|
|
6098
|
+
*/
|
|
6099
|
+
expires_at: string | null;
|
|
6100
|
+
/**
|
|
6101
|
+
* Who gave it (the API key).
|
|
6102
|
+
*/
|
|
6103
|
+
granted_by: string;
|
|
6104
|
+
/**
|
|
6105
|
+
* The grant's id.
|
|
6106
|
+
*/
|
|
6107
|
+
id: string;
|
|
6108
|
+
/**
|
|
6109
|
+
* Why.
|
|
6110
|
+
*/
|
|
6111
|
+
reason: string;
|
|
6112
|
+
/**
|
|
6113
|
+
* When it was revoked.
|
|
6114
|
+
*/
|
|
6115
|
+
revoked_at: string | null;
|
|
6116
|
+
/**
|
|
6117
|
+
* When it started.
|
|
6118
|
+
*/
|
|
6119
|
+
starts_at: string;
|
|
6120
|
+
/**
|
|
6121
|
+
* Who revoked it (the API key or user); null while it is not.
|
|
6122
|
+
*/
|
|
6123
|
+
revoked_by: string | null;
|
|
6124
|
+
/**
|
|
6125
|
+
* Given now: started, not ended, not revoked.
|
|
6126
|
+
*/
|
|
6127
|
+
active: boolean;
|
|
6128
|
+
};
|
|
6129
|
+
/**
|
|
6130
|
+
* The grants given a customer, the newest first.
|
|
6131
|
+
*/
|
|
6132
|
+
export type CustomerGrants = {
|
|
6133
|
+
/**
|
|
6134
|
+
* The customer.
|
|
6135
|
+
*/
|
|
6136
|
+
customer_id: string;
|
|
6137
|
+
grants: GrantRecord[];
|
|
6138
|
+
};
|
|
6139
|
+
/**
|
|
6140
|
+
* A revision of the catalog, as the list shows it.
|
|
6141
|
+
*/
|
|
6142
|
+
export type CatalogRevision = {
|
|
6143
|
+
/**
|
|
6144
|
+
* Its number.
|
|
6145
|
+
*/
|
|
6146
|
+
revision: number;
|
|
6147
|
+
/**
|
|
6148
|
+
* When it was saved.
|
|
6149
|
+
*/
|
|
6150
|
+
created_at: string;
|
|
6151
|
+
/**
|
|
6152
|
+
* Who saved it (the API key or user).
|
|
6153
|
+
*/
|
|
6154
|
+
created_by: string;
|
|
6155
|
+
/**
|
|
6156
|
+
* The catalog is this revision now.
|
|
6157
|
+
*/
|
|
6158
|
+
current: boolean;
|
|
6159
|
+
/**
|
|
6160
|
+
* How many products it defines.
|
|
6161
|
+
*/
|
|
6162
|
+
products: number;
|
|
6163
|
+
/**
|
|
6164
|
+
* How many entitlements it defines.
|
|
6165
|
+
*/
|
|
6166
|
+
entitlements: number;
|
|
6167
|
+
/**
|
|
6168
|
+
* How many credit currencies it defines.
|
|
6169
|
+
*/
|
|
6170
|
+
currencies: number;
|
|
6171
|
+
/**
|
|
6172
|
+
* How many limits it defines.
|
|
6173
|
+
*/
|
|
6174
|
+
limits: number;
|
|
6175
|
+
/**
|
|
6176
|
+
* How many offers it defines.
|
|
6177
|
+
*/
|
|
6178
|
+
offers: number;
|
|
6179
|
+
/**
|
|
6180
|
+
* When a confirmed plan of it was last written to the stores; null for one never written.
|
|
6181
|
+
*/
|
|
6182
|
+
applied_at: string | null;
|
|
6183
|
+
};
|
|
6184
|
+
/**
|
|
6185
|
+
* The catalog's revisions, the newest first.
|
|
6186
|
+
*/
|
|
6187
|
+
export type CatalogRevisions = {
|
|
6188
|
+
revisions: CatalogRevision[];
|
|
6189
|
+
/**
|
|
6190
|
+
* Goes on to the next page (send it as `cursor`); absent on the last page.
|
|
6191
|
+
*/
|
|
6192
|
+
next_cursor?: string;
|
|
6193
|
+
};
|
|
6194
|
+
/**
|
|
6195
|
+
* An entitlement, and the product that gives it with more of a limit.
|
|
6196
|
+
*/
|
|
6197
|
+
export type LimitUpgrade = {
|
|
6198
|
+
/**
|
|
6199
|
+
* The entitlement.
|
|
6200
|
+
*/
|
|
6201
|
+
entitlement: string;
|
|
6202
|
+
/**
|
|
6203
|
+
* The entitlement's name, as the catalog gives it.
|
|
6204
|
+
*/
|
|
6205
|
+
name: string;
|
|
6206
|
+
/**
|
|
6207
|
+
* The product that gives it.
|
|
6208
|
+
*/
|
|
6209
|
+
product: string;
|
|
6210
|
+
/**
|
|
6211
|
+
* What the product gives of the limit in a window.
|
|
6212
|
+
*/
|
|
6213
|
+
max: number;
|
|
6214
|
+
};
|
|
6215
|
+
/**
|
|
6216
|
+
* The error envelope of a refused spend: with `limit_reached`, the limit and what would give the customer more of it.
|
|
6217
|
+
*/
|
|
6218
|
+
export type SpendRefusal = {
|
|
6219
|
+
/**
|
|
6220
|
+
* Machine-readable error code (snake_case)
|
|
6221
|
+
*/
|
|
6222
|
+
error: string;
|
|
6223
|
+
/**
|
|
6224
|
+
* Human-readable explanation
|
|
6225
|
+
*/
|
|
6226
|
+
error_description: string;
|
|
6227
|
+
/**
|
|
6228
|
+
* Correlation ID for log/audit lookup
|
|
6229
|
+
*/
|
|
6230
|
+
request_id: string;
|
|
6231
|
+
/**
|
|
6232
|
+
* Seconds to wait before retrying; present on a refusal that ends with time.
|
|
6233
|
+
*/
|
|
6234
|
+
retry_after?: number;
|
|
6235
|
+
/**
|
|
6236
|
+
* HTTP status code (mirrors the response status)
|
|
6237
|
+
*/
|
|
6238
|
+
status: number;
|
|
6239
|
+
/**
|
|
6240
|
+
* With `limit_reached`: the limit.
|
|
6241
|
+
*/
|
|
6242
|
+
limit?: string;
|
|
6243
|
+
/**
|
|
6244
|
+
* With `limit_reached`: the entitlements whose products give more of the limit than the customer has now, the smallest step up first (empty when none does) — for the app to offer.
|
|
6245
|
+
*/
|
|
6246
|
+
upgrades?: LimitUpgrade[];
|
|
6247
|
+
};
|
|
5940
6248
|
/** The events this module sends the project's webhooks (x-palbase-events), by type: each one's payload, the event's data. */
|
|
5941
6249
|
export interface Events {
|
|
5942
6250
|
/**
|
|
@@ -6391,6 +6699,17 @@ export declare function client(t: Transport): {
|
|
|
6391
6699
|
body: CreditForgiveRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
6392
6700
|
signal?: AbortSignal;
|
|
6393
6701
|
}): Promise<Reply<200, CreditForgiven>>;
|
|
6702
|
+
/**
|
|
6703
|
+
* List a customer's grants
|
|
6704
|
+
*
|
|
6705
|
+
* The grants given the customer, active, ended and revoked, the newest first (at most 500): a grant is revoked by the id read here (DELETE …/grants/{grant_id}).
|
|
6706
|
+
*/
|
|
6707
|
+
listCustomerGrants(input: {
|
|
6708
|
+
path: {
|
|
6709
|
+
customer_id: string;
|
|
6710
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
6711
|
+
signal?: AbortSignal;
|
|
6712
|
+
}): Promise<Reply<200, CustomerGrants>>;
|
|
6394
6713
|
/**
|
|
6395
6714
|
* Grant an entitlement
|
|
6396
6715
|
*
|
|
@@ -7283,5 +7602,69 @@ export declare function client(t: Transport): {
|
|
|
7283
7602
|
body: XcodeOfferKeyRequest; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
7284
7603
|
signal?: AbortSignal;
|
|
7285
7604
|
}): Promise<Reply<200, XcodeOfferKey>>;
|
|
7605
|
+
/**
|
|
7606
|
+
* Find customers
|
|
7607
|
+
*
|
|
7608
|
+
* Finds customers by what a person writing in has: their id; Apple's original transaction id or any transaction id of theirs; a Google order id (a renewal's `..N` or not); Stripe's subscription, payment intent, invoice or customer id; or the email address a buyer with no account gave at checkout, matched whole (case and spaces around it aside). The address is never kept: an HMAC of it is.
|
|
7609
|
+
*/
|
|
7610
|
+
searchCustomers(input: {
|
|
7611
|
+
query: {
|
|
7612
|
+
q: string;
|
|
7613
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
7614
|
+
signal?: AbortSignal;
|
|
7615
|
+
}): Promise<Reply<200, CustomerSearch>>;
|
|
7616
|
+
/**
|
|
7617
|
+
* Read a customer's history
|
|
7618
|
+
*
|
|
7619
|
+
* What happened to the customer, the newest first: their purchases' payments and refunds, their subscriptions' renewal turned off and on, failed charges and ends, the grants given and taken back (with their reason and by whom), the credits granted, taken back, expired and forgiven (spends are the credits' entries: GET …/credits/entries), and the purchases that moved to or from them.
|
|
7620
|
+
*/
|
|
7621
|
+
getCustomerHistory(input: {
|
|
7622
|
+
path: {
|
|
7623
|
+
customer_id: string;
|
|
7624
|
+
};
|
|
7625
|
+
query?: {
|
|
7626
|
+
cursor?: string; /** Events in a page (default 50). */
|
|
7627
|
+
limit?: number;
|
|
7628
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
7629
|
+
signal?: AbortSignal;
|
|
7630
|
+
}): Promise<Reply<200, CustomerHistory>>;
|
|
7631
|
+
/**
|
|
7632
|
+
* List the catalog's revisions
|
|
7633
|
+
*
|
|
7634
|
+
* Every revision the catalog was saved as, the newest first: who saved it, when, what it defines, and when a confirmed plan of it was last written to the stores.
|
|
7635
|
+
*/
|
|
7636
|
+
listCatalogRevisions(input?: {
|
|
7637
|
+
query?: {
|
|
7638
|
+
cursor?: string; /** Revisions in a page (default 50). */
|
|
7639
|
+
limit?: number;
|
|
7640
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
7641
|
+
signal?: AbortSignal;
|
|
7642
|
+
}): Promise<Reply<200, CatalogRevisions>>;
|
|
7643
|
+
/**
|
|
7644
|
+
* Read a revision of the catalog
|
|
7645
|
+
*
|
|
7646
|
+
* The catalog as it was saved at that revision.
|
|
7647
|
+
*/
|
|
7648
|
+
getCatalogRevision(input: {
|
|
7649
|
+
path: {
|
|
7650
|
+
revision: number;
|
|
7651
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
7652
|
+
signal?: AbortSignal;
|
|
7653
|
+
}): Promise<Reply<200, CatalogDoc>>;
|
|
7654
|
+
/**
|
|
7655
|
+
* Put an older revision back
|
|
7656
|
+
*
|
|
7657
|
+
* Saves the revision's catalog as the next revision, as an edit is: checked against the catalog's rules now (an older revision may break one added since: 422 `invalid_catalog`), what customers bought kept in it, If-Match the revision the catalog is now. Nothing is written to a store: a plan of it is made and confirmed (POST /purchases/catalog/plans). Emits `purchases.catalog.changed` with `restored_from`.
|
|
7658
|
+
*/
|
|
7659
|
+
restoreCatalogRevision(input: {
|
|
7660
|
+
path: {
|
|
7661
|
+
revision: number;
|
|
7662
|
+
};
|
|
7663
|
+
headers: {
|
|
7664
|
+
"If-Match": string; /** Makes the write safe to send again (at most 255 characters). A retry with the same key and the same request gets the first answer back, marked `Idempotent-Replayed: true`, and changes nothing; the same key with a different request is refused with 422, and while the first request still runs a retry gets 409 with Retry-After. Answers are kept for 24 hours. */
|
|
7665
|
+
"Idempotency-Key"?: string;
|
|
7666
|
+
}; /** Stops the call: the request in flight, a wait before a retry, a proof-of-work being solved. */
|
|
7667
|
+
signal?: AbortSignal;
|
|
7668
|
+
}): Promise<Reply<200, CatalogDoc>>;
|
|
7286
7669
|
};
|
|
7287
7670
|
export type Client = ReturnType<typeof client>;
|