palbase 0.18.6 → 0.19.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.
Files changed (53) hide show
  1. package/README.md +14 -0
  2. package/dist/ai/index.js +2 -2
  3. package/dist/backend/engine.js +2 -2
  4. package/dist/backend/env.js +1 -1
  5. package/dist/backend/index.js +3 -3
  6. package/dist/backend/stack.js +1 -1
  7. package/dist/backend/test.js +2 -2
  8. package/dist/chunks/{L4SDE4IC.js → 26R7KNH7.js} +2 -2
  9. package/dist/chunks/{S76H65KW.js → 2XM3DQXS.js} +2 -2
  10. package/dist/chunks/{E4CPOSFA.js → 424IEUQX.js} +2 -2
  11. package/dist/chunks/{NIDBDL7O.js → 43RXGTTL.js} +1 -1
  12. package/dist/chunks/{OL33SRTB.js → B6OLQP6W.js} +2 -2
  13. package/dist/chunks/{U6UXSVEZ.js → EDIQ4SAO.js} +2 -2
  14. package/dist/chunks/{6HESVOSN.js → F5CWCOSS.js} +1 -1
  15. package/dist/chunks/{6IHNI2FC.js → HM7G4WGJ.js} +2 -2
  16. package/dist/chunks/{7HE22VDH.js → KE4DEYSH.js} +1 -1
  17. package/dist/chunks/{Y76SPW2M.js → LCBMI6UP.js} +1 -1
  18. package/dist/chunks/{OGP5DLL6.js → LRWWDIJZ.js} +2 -2
  19. package/dist/chunks/{C53PUTQR.js → MI3PAKT3.js} +2 -2
  20. package/dist/chunks/{BDD3FVHP.js → PRIISRPI.js} +2 -2
  21. package/dist/chunks/{Q2O72MGS.js → QOUBSZM4.js} +1 -1
  22. package/dist/chunks/{U4R3KQT6.js → RIQJUVZK.js} +1 -1
  23. package/dist/chunks/{RUE6N2T6.js → SGASB5G4.js} +2 -2
  24. package/dist/chunks/{6JA355QW.js → TOPRHPT6.js} +1 -1
  25. package/dist/chunks/{ARDQJVIP.js → V2GWROU3.js} +2 -2
  26. package/dist/chunks/{RHLHSALC.js → V6TFL4HC.js} +2 -2
  27. package/dist/chunks/{5N36M3Y3.js → WHKAPZX7.js} +2 -2
  28. package/dist/chunks/{4HYASQT5.js → Y4THIE6E.js} +2 -2
  29. package/dist/chunks/Z4YKS2EK.js +2 -0
  30. package/dist/chunks/{IO3G5VIC.js → ZW57VOIW.js} +2 -2
  31. package/dist/cli.js +3 -3
  32. package/dist/cloud/index.js +2 -0
  33. package/dist/refuse/ai.js +1 -1
  34. package/dist/refuse/backend.js +1 -1
  35. package/dist/refuse/cloud.js +2 -0
  36. package/dist/refuse/server.js +1 -1
  37. package/dist/server/index.js +2 -2
  38. package/dist/server/testing.js +2 -2
  39. package/dist/web/index.js +2 -2
  40. package/dist/web/message.js +2 -2
  41. package/dist/web/palbe.js +2 -2
  42. package/dist/web/paywall.js +2 -2
  43. package/dist/web/push-sw.js +1 -1
  44. package/dist/web/ssr.js +2 -2
  45. package/dist/web/vite.js +2 -2
  46. package/package.json +18 -4
  47. package/types/cloud/src/cloud.d.ts +23 -0
  48. package/types/cloud/src/generated/project.d.ts +19 -0
  49. package/types/cloud/src/generated/studio.d.ts +1765 -0
  50. package/types/cloud/src/index.d.ts +7 -0
  51. package/types/cloud/src/token.d.ts +6 -0
  52. package/types/internal/src/transport.d.ts +10 -1
  53. package/dist/chunks/RGZZCQMZ.js +0 -2
package/dist/cli.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
- /*! palbase 0.18.6 — Palbase SDK License (see LICENSE) */
3
- var Fy=Object.defineProperty;var tt=(e,t)=>{for(var n in t)Fy(e,n,{get:t[n],enumerable:!0})};import{parseArgs as Tb}from"node:util";var Jy=Symbol.for("palbase.data"),Wy=globalThis,Ll=Wy[Jy]??=new WeakSet;function Vy(e){return e instanceof Date||ArrayBuffer.isView(e)||e instanceof ArrayBuffer}function va(e){let t=[e];for(;t.length>0;){let n=t.pop();if(!(typeof n!="object"||n===null||Ll.has(n)||Vy(n))){Ll.add(n);for(let s of Array.isArray(n)?n:Object.values(n))t.push(s)}}return e}var Hy="X-PoW-Challenge-ID",Xy="X-PoW-Nonce";function Dl(e){if(typeof e!="object"||e===null)return null;let t=e;if(t.error!=="pow_required"||typeof t.challenge!="object"||t.challenge===null)return null;let{id:n,prefix:s,difficulty:a}=t.challenge;return typeof n!="string"||typeof s!="string"||typeof a!="number"||!Number.isInteger(a)||a<0?null:{id:n,prefix:s,difficulty:a}}function Yy(e){return 8*2**e}var Un;async function Zy(){if(Un)return Un;let e=globalThis;if(e.process?.versions?.node!==void 0||e.process?.versions?.bun!==void 0)try{let s=(await import("node:crypto")).createHash;if(typeof s=="function")return Un=a=>new Uint8Array(s("sha256").update(a).digest()),Un}catch{}let t=new TextEncoder;return Un=async n=>new Uint8Array(await crypto.subtle.digest("SHA-256",t.encode(n))),Un}function Qy(e){let t=0;for(let n of e){if(n===0){t+=8;continue}return t+Math.clz32(n)-24}return t}var eb=4096,tb=typeof globalThis.setImmediate=="function"?()=>new Promise(e=>globalThis.setImmediate(e)):()=>new Promise(e=>setTimeout(e,0));async function Nl(e,t={}){if(e.difficulty>24)throw new Error(`proof-of-work: difficulty ${e.difficulty} is above auth's ceiling of 24`);let n=await Zy(),s=Yy(e.difficulty),a=Date.now()+(t.timeLimitMs??12e4);for(let r=0;r<s;r++){if(r%eb===0&&r>0){if(await tb(),t.signal?.aborted)throw t.signal.reason??new DOMException("proof-of-work aborted","AbortError");if(Date.now()>a)throw new Error(`proof-of-work: gave up on difficulty ${e.difficulty} after ${r} attempts`)}let i=n(e.prefix+r),o=i instanceof Uint8Array?i:await i;if(Qy(o)>=e.difficulty)return{[Hy]:e.id,[Xy]:String(r)}}throw new Error(`proof-of-work: no nonce for difficulty ${e.difficulty} within ${s} attempts`)}var x=class extends Error{status;code;requestId;retryAfter;body;op;get isNetworkError(){return this.code==="network_error"}constructor(t){super(t.message,t.cause===void 0?void 0:{cause:t.cause}),this.name="PalbaseError",this.op=t.op,this.status=t.status,this.code=t.code,this.requestId=t.requestId,this.retryAfter=t.retryAfter,this.body=t.body}};function g(e,t,n){let s=String(n);if(s===""||s==="."||s==="..")throw new x({op:e,status:0,code:"invalid_path_parameter",message:`${e}: ${t} cannot be ${s===""?"empty":JSON.stringify(s)}`});return encodeURIComponent(s)}var nb=new Set(["apikey","authorization"]),sb=64*1024;function ai(e){let t=_a(e.baseUrl),n=e.fetch??globalThis.fetch,s=e.solveProofOfWork??!0,a=async(r,i)=>{let o=ib(t,r),l=new Headers;for(let[b,w]of Object.entries(r.headers??{}))w!=null&&!nb.has(b.toLowerCase())&&l.set(b,String(w));for(let[b,w]of Object.entries(i))l.set(b,w);await ob(r,e.credentials,l),l.has("accept")||l.set("accept","application/json");let d={method:r.method,headers:l,redirect:"manual",signal:r.signal,...r.keepalive?{keepalive:!0}:{}};r.body&&r.body.value!==void 0&&(l.set("content-type",r.body.contentType),d.body=lb(r.body.kind,r.body.value),zn(d.body)||(d.duplex="half"));let p;try{p=r.onUploadProgress&&e.xmlHttpRequest?await ab(e.xmlHttpRequest,r.op,o,d,r.onUploadProgress):await n(o,d)}catch(b){throw r.signal?.aborted||b instanceof x?b:new x({op:r.op,status:0,code:"network_error",message:`${r.op}: the request did not reach ${t.origin}`,cause:b})}let u=r.answers[p.status];if(u===void 0)throw p.status>=200&&p.status<300?(await p.body?.cancel(),new x({op:r.op,status:p.status,code:"undeclared_answer",message:`${r.op}: the server answered ${p.status}, which its contract does not declare; the request may have taken effect`})):await db(r.op,p);let h;switch(u){case"json":try{h=va(await p.json())}catch(b){throw new x({op:r.op,status:p.status,code:"invalid_json",message:`${r.op}: the answer is not JSON`,cause:b})}break;case"raw":h=p;break;default:await p.body?.cancel(),h=void 0}return{status:p.status,data:h,headers:p.headers}};return{async send(r){try{return await a(r,{})}catch(i){let o=s&&i instanceof x&&i.status===403?Dl(i.body):null,l=r.body?.value;if(!o||r.body?.kind==="raw"&&!zn(l))throw i;let d=i,p;try{p=await Nl(o,{signal:r.signal})}catch(u){throw r.signal?.aborted?u:new x({op:r.op,status:403,code:"pow_unsolved",message:`${r.op}: ${u instanceof Error?u.message:String(u)}`,requestId:d.requestId,body:d.body,cause:u})}return a(r,p)}}}}function ab(e,t,n,s,a){return new Promise((r,i)=>{let o=s.signal;if(o?.aborted)return i(o.reason);let l=new e,d=()=>l.abort();o?.addEventListener("abort",d,{once:!0});let p=u=>{o?.removeEventListener("abort",d),u()};l.open(s.method??"GET",n.href),l.responseType="arraybuffer",new Headers(s.headers).forEach((u,h)=>l.setRequestHeader(h,u)),l.upload&&(l.upload.onprogress=u=>{u.lengthComputable&&a(u.loaded,u.total)}),l.onload=()=>p(()=>{if(l.responseURL!==""&&l.responseURL!==n.href){i(new x({op:t,status:0,code:"undeclared_redirect",message:`${t}: the server redirected; the answer is another address's, and was not read`}));return}if(l.status<200||l.status>599)return i(new TypeError(`${t}: answered ${l.status}`));let u=l.status===204||l.status===205||l.status===304;r(new Response(u?null:l.response,{status:l.status,statusText:l.statusText,headers:rb(l.getAllResponseHeaders())}))}),l.onerror=()=>p(()=>i(new TypeError(`${t}: the request failed`))),l.onabort=()=>p(()=>i(o?.reason??new DOMException("The request was aborted","AbortError"))),l.send(s.body)})}function rb(e){let t=new Headers;for(let n of e.split(/\r?\n/)){let s=n.indexOf(":");if(!(s<=0))try{t.append(n.slice(0,s).trim(),n.slice(s+1).trim())}catch{}}return t}function _a(e){let t;try{t=new URL(e)}catch{throw new TypeError(`baseUrl ${JSON.stringify(e)} is not an absolute URL`)}let n=t.hostname==="localhost"||t.hostname.endsWith(".localhost")||t.hostname==="127.0.0.1"||t.hostname==="[::1]";if(t.protocol!=="https:"&&!(t.protocol==="http:"&&n))throw new TypeError(`baseUrl must be https (http only for a loopback address): ${t.origin}`);if(t.username||t.password||t.search||t.hash)throw new TypeError("baseUrl carries no user, query or fragment");if(t.pathname!=="/"&&t.pathname!=="")throw new TypeError("baseUrl is the project origin alone, with no path");return t}function ib(e,t){if(!t.path.startsWith("/")||t.path.startsWith("//"))throw new x({op:t.op,status:0,code:"invalid_path",message:`${t.op}: path ${JSON.stringify(t.path)} is not absolute`});let n=new URL(t.path+pb(t.query),e);if(n.origin!==e.origin)throw new x({op:t.op,status:0,code:"invalid_path",message:`${t.op}: path leaves the project's origin`});return n}async function ob(e,t,n){if(e.auth.length===0)return;let s=e.auth.some(i=>i.includes("userJWT"))?await t.accessToken?.():void 0,a=i=>{switch(i){case"ApiKeyAuth":return!!(t.publishableKey??t.secretKey);case"SecretKeyAuth":case"AdminAuth":return!!t.secretKey;case"userJWT":return!!s;default:return!1}},r=e.auth.filter(i=>i.every(a)).reduce((i,o)=>i===void 0||o.length>i.length?o:i,void 0);if(!r)throw new x({op:e.op,status:0,code:"missing_credential",message:`${e.op} needs one of: ${e.auth.map(i=>i.length===0?"nothing":i.join(" + ")).join(" | ")}`});for(let i of r)i==="ApiKeyAuth"?n.set("apikey",t.publishableKey??t.secretKey):i==="SecretKeyAuth"||i==="AdminAuth"?n.set("apikey",t.secretKey):i==="userJWT"&&n.set("authorization",`Bearer ${s}`)}function lb(e,t){switch(e){case"json":return JSON.stringify(t);case"form":{let n=new URLSearchParams;for(let[s,a]of Object.entries(t))ri(n,s,a);return n}case"raw":return t}}function zn(e){return!!(e==null||typeof e=="string"||e instanceof URLSearchParams||e instanceof Blob||e instanceof FormData||e instanceof ArrayBuffer||ArrayBuffer.isView(e))}function pb(e){if(!e)return"";let t=new URLSearchParams;for(let[s,a]of Object.entries(e))ri(t,s,a);let n=t.toString();return n===""?"":`?${n}`}function ri(e,t,n){if(n!=null){if(Array.isArray(n)){for(let s of n)ri(e,t,s);return}if(n instanceof Date){e.append(t,n.toISOString());return}e.append(t,typeof n=="object"?JSON.stringify(n):String(n))}}async function db(e,t){let n=await ub(t,sb).catch(()=>""),s;try{s=n===""?void 0:JSON.parse(n)}catch{s=n}let a=cb(s)?s:void 0,r=Number(t.headers.get("retry-after")),i=t.status>=300&&t.status<400;return new x({op:e,status:t.status,code:a?.error??(i?"undeclared_redirect":`http_${t.status}`),message:a?.error_description??(i?`${e}: the server redirected (${t.status}); the request was not followed, its credentials stay here`:`${e}: ${t.status} ${t.statusText}`.trim()),requestId:a?.request_id??t.headers.get("x-request-id")??void 0,retryAfter:a?.retry_after??(Number.isFinite(r)&&r>0?r:void 0),body:s})}async function ub(e,t){if(!e.body)return"";let n=e.body.getReader(),s=[],a=0;for(;a<t;){let{done:o,value:l}=await n.read();if(o)break;s.push(l),a+=l.byteLength}await n.cancel().catch(()=>{});let r=new Uint8Array(Math.min(a,t)),i=0;for(let o of s){let l=Math.min(o.byteLength,r.byteLength-i);if(r.set(o.subarray(0,l),i),i+=l,i>=r.byteLength)break}return new TextDecoder().decode(r)}function cb(e){return typeof e=="object"&&e!==null&&typeof e.error=="string"}var ka={project:{type:"string",short:"P",value:"project",description:"the project (name or id; org/project when the name is in two organizations)"},env:{type:"string",short:"E",value:"env",description:"the project's environment (slug or ref)"},json:{type:"boolean",description:"print the answer as JSON"},"non-interactive":{type:"boolean",description:"never ask: refuse what would need a question"},yes:{type:"boolean",short:"y",description:"confirm a change to a production environment without asking"},debug:{type:"boolean",description:"print each request the command sends"},help:{type:"boolean",short:"h",description:"show help"}};var y=class extends Error{exitCode;hint;code;reported;constructor(t,n,s={}){super(n),this.name="CliError",this.code=t,this.hint=s.hint,this.exitCode=s.exitCode??1,this.reported=s.reported??!1}};function m(e,t){return new y("usage",e,{hint:t,exitCode:2})}var Sa=class{io;json;constructor(t,n){this.io=t,this.json=n}result(t,n){this.json?this.io.stdout(`${JSON.stringify(t,null,2)}
2
+ /*! palbase 0.19.0 — Palbase SDK License (see LICENSE) */
3
+ var Fy=Object.defineProperty;var tt=(e,t)=>{for(var n in t)Fy(e,n,{get:t[n],enumerable:!0})};import{parseArgs as Tb}from"node:util";var Jy=Symbol.for("palbase.data"),Wy=globalThis,Ll=Wy[Jy]??=new WeakSet;function Vy(e){return e instanceof Date||ArrayBuffer.isView(e)||e instanceof ArrayBuffer}function va(e){let t=[e];for(;t.length>0;){let n=t.pop();if(!(typeof n!="object"||n===null||Ll.has(n)||Vy(n))){Ll.add(n);for(let s of Array.isArray(n)?n:Object.values(n))t.push(s)}}return e}var Hy="X-PoW-Challenge-ID",Xy="X-PoW-Nonce";function Dl(e){if(typeof e!="object"||e===null)return null;let t=e;if(t.error!=="pow_required"||typeof t.challenge!="object"||t.challenge===null)return null;let{id:n,prefix:s,difficulty:a}=t.challenge;return typeof n!="string"||typeof s!="string"||typeof a!="number"||!Number.isInteger(a)||a<0?null:{id:n,prefix:s,difficulty:a}}function Yy(e){return 8*2**e}var Un;async function Zy(){if(Un)return Un;let e=globalThis;if(e.process?.versions?.node!==void 0||e.process?.versions?.bun!==void 0)try{let s=(await import("node:crypto")).createHash;if(typeof s=="function")return Un=a=>new Uint8Array(s("sha256").update(a).digest()),Un}catch{}let t=new TextEncoder;return Un=async n=>new Uint8Array(await crypto.subtle.digest("SHA-256",t.encode(n))),Un}function Qy(e){let t=0;for(let n of e){if(n===0){t+=8;continue}return t+Math.clz32(n)-24}return t}var eb=4096,tb=typeof globalThis.setImmediate=="function"?()=>new Promise(e=>globalThis.setImmediate(e)):()=>new Promise(e=>setTimeout(e,0));async function Nl(e,t={}){if(e.difficulty>24)throw new Error(`proof-of-work: difficulty ${e.difficulty} is above auth's ceiling of 24`);let n=await Zy(),s=Yy(e.difficulty),a=Date.now()+(t.timeLimitMs??12e4);for(let r=0;r<s;r++){if(r%eb===0&&r>0){if(await tb(),t.signal?.aborted)throw t.signal.reason??new DOMException("proof-of-work aborted","AbortError");if(Date.now()>a)throw new Error(`proof-of-work: gave up on difficulty ${e.difficulty} after ${r} attempts`)}let i=n(e.prefix+r),o=i instanceof Uint8Array?i:await i;if(Qy(o)>=e.difficulty)return{[Hy]:e.id,[Xy]:String(r)}}throw new Error(`proof-of-work: no nonce for difficulty ${e.difficulty} within ${s} attempts`)}var x=class extends Error{status;code;requestId;retryAfter;body;op;get isNetworkError(){return this.code==="network_error"}constructor(t){super(t.message,t.cause===void 0?void 0:{cause:t.cause}),this.name="PalbaseError",this.op=t.op,this.status=t.status,this.code=t.code,this.requestId=t.requestId,this.retryAfter=t.retryAfter,this.body=t.body}};function g(e,t,n){let s=String(n);if(s===""||s==="."||s==="..")throw new x({op:e,status:0,code:"invalid_path_parameter",message:`${e}: ${t} cannot be ${s===""?"empty":JSON.stringify(s)}`});return encodeURIComponent(s)}var nb=new Set(["apikey","authorization"]),sb=64*1024;function ai(e){let t=_a(e.baseUrl),n=e.fetch??globalThis.fetch,s=e.solveProofOfWork??!0,a=async(r,i)=>{let o=ib(t,r),l=new Headers;for(let[b,w]of Object.entries(r.headers??{}))w!=null&&!nb.has(b.toLowerCase())&&l.set(b,String(w));for(let[b,w]of Object.entries(i))l.set(b,w);await ob(r,e.credentials,l),l.has("accept")||l.set("accept","application/json");let d={method:r.method,headers:l,redirect:"manual",signal:r.signal,...r.keepalive?{keepalive:!0}:{}};r.body&&r.body.value!==void 0&&(l.set("content-type",r.body.contentType),d.body=lb(r.body.kind,r.body.value),zn(d.body)||(d.duplex="half"));let p;try{p=r.onUploadProgress&&e.xmlHttpRequest?await ab(e.xmlHttpRequest,r.op,o,d,r.onUploadProgress):await n(o,d)}catch(b){throw r.signal?.aborted||b instanceof x?b:new x({op:r.op,status:0,code:"network_error",message:`${r.op}: the request did not reach ${t.origin}`,cause:b})}let u=r.answers[p.status]??(r.ownResponse&&p.status>=200&&p.status<300?"raw":void 0);if(u===void 0)throw p.status>=200&&p.status<300?(await p.body?.cancel(),new x({op:r.op,status:p.status,code:"undeclared_answer",message:`${r.op}: the server answered ${p.status}, which its contract does not declare; the request may have taken effect`})):await db(r.op,p);let h;switch(u){case"json":try{h=va(await p.json())}catch(b){throw new x({op:r.op,status:p.status,code:"invalid_json",message:`${r.op}: the answer is not JSON`,cause:b})}break;case"raw":h=p;break;default:await p.body?.cancel(),h=void 0}return{status:p.status,data:h,headers:p.headers}};return{async send(r){try{return await a(r,{})}catch(i){let o=s&&i instanceof x&&i.status===403?Dl(i.body):null,l=r.body?.value;if(!o||r.body?.kind==="raw"&&!zn(l))throw i;let d=i,p;try{p=await Nl(o,{signal:r.signal})}catch(u){throw r.signal?.aborted?u:new x({op:r.op,status:403,code:"pow_unsolved",message:`${r.op}: ${u instanceof Error?u.message:String(u)}`,requestId:d.requestId,body:d.body,cause:u})}return a(r,p)}}}}function ab(e,t,n,s,a){return new Promise((r,i)=>{let o=s.signal;if(o?.aborted)return i(o.reason);let l=new e,d=()=>l.abort();o?.addEventListener("abort",d,{once:!0});let p=u=>{o?.removeEventListener("abort",d),u()};l.open(s.method??"GET",n.href),l.responseType="arraybuffer",new Headers(s.headers).forEach((u,h)=>l.setRequestHeader(h,u)),l.upload&&(l.upload.onprogress=u=>{u.lengthComputable&&a(u.loaded,u.total)}),l.onload=()=>p(()=>{if(l.responseURL!==""&&l.responseURL!==n.href){i(new x({op:t,status:0,code:"undeclared_redirect",message:`${t}: the server redirected; the answer is another address's, and was not read`}));return}if(l.status<200||l.status>599)return i(new TypeError(`${t}: answered ${l.status}`));let u=l.status===204||l.status===205||l.status===304;r(new Response(u?null:l.response,{status:l.status,statusText:l.statusText,headers:rb(l.getAllResponseHeaders())}))}),l.onerror=()=>p(()=>i(new TypeError(`${t}: the request failed`))),l.onabort=()=>p(()=>i(o?.reason??new DOMException("The request was aborted","AbortError"))),l.send(s.body)})}function rb(e){let t=new Headers;for(let n of e.split(/\r?\n/)){let s=n.indexOf(":");if(!(s<=0))try{t.append(n.slice(0,s).trim(),n.slice(s+1).trim())}catch{}}return t}function _a(e){let t;try{t=new URL(e)}catch{throw new TypeError(`baseUrl ${JSON.stringify(e)} is not an absolute URL`)}let n=t.hostname==="localhost"||t.hostname.endsWith(".localhost")||t.hostname==="127.0.0.1"||t.hostname==="[::1]";if(t.protocol!=="https:"&&!(t.protocol==="http:"&&n))throw new TypeError(`baseUrl must be https (http only for a loopback address): ${t.origin}`);if(t.username||t.password||t.search||t.hash)throw new TypeError("baseUrl carries no user, query or fragment");if(t.pathname!=="/"&&t.pathname!=="")throw new TypeError("baseUrl is the project origin alone, with no path");return t}function ib(e,t){if(!t.path.startsWith("/")||t.path.startsWith("//"))throw new x({op:t.op,status:0,code:"invalid_path",message:`${t.op}: path ${JSON.stringify(t.path)} is not absolute`});let n=new URL(t.path+pb(t.query),e);if(n.origin!==e.origin)throw new x({op:t.op,status:0,code:"invalid_path",message:`${t.op}: path leaves the project's origin`});return n}async function ob(e,t,n){if(e.auth.length===0)return;let s=e.auth.some(i=>i.includes("userJWT"))?await t.accessToken?.():void 0,a=i=>{switch(i){case"ApiKeyAuth":return!!(t.publishableKey??t.secretKey);case"SecretKeyAuth":case"AdminAuth":return!!(t.secretKey??t.token);case"PalbaseBearer":return!!t.token;case"userJWT":return!!s&&!t.token;default:return!1}},r=e.auth.filter(i=>i.every(a)).reduce((i,o)=>i===void 0||o.length>i.length?o:i,void 0);if(!r)throw new x({op:e.op,status:0,code:"missing_credential",message:`${e.op} needs one of: ${e.auth.map(i=>i.length===0?"nothing":i.join(" + ")).join(" | ")}`});for(let i of r)i==="ApiKeyAuth"?n.set("apikey",t.publishableKey??t.secretKey):(i==="SecretKeyAuth"||i==="AdminAuth"||i==="PalbaseBearer")&&t.token?n.set("authorization",`Bearer ${t.token}`):i==="SecretKeyAuth"||i==="AdminAuth"?n.set("apikey",t.secretKey):i==="userJWT"&&n.set("authorization",`Bearer ${s}`)}function lb(e,t){switch(e){case"json":return JSON.stringify(t);case"form":{let n=new URLSearchParams;for(let[s,a]of Object.entries(t))ri(n,s,a);return n}case"raw":return t}}function zn(e){return!!(e==null||typeof e=="string"||e instanceof URLSearchParams||e instanceof Blob||e instanceof FormData||e instanceof ArrayBuffer||ArrayBuffer.isView(e))}function pb(e){if(!e)return"";let t=new URLSearchParams;for(let[s,a]of Object.entries(e))ri(t,s,a);let n=t.toString();return n===""?"":`?${n}`}function ri(e,t,n){if(n!=null){if(Array.isArray(n)){for(let s of n)ri(e,t,s);return}if(n instanceof Date){e.append(t,n.toISOString());return}e.append(t,typeof n=="object"?JSON.stringify(n):String(n))}}async function db(e,t){let n=await ub(t,sb).catch(()=>""),s;try{s=n===""?void 0:JSON.parse(n)}catch{s=n}let a=cb(s)?s:void 0,r=Number(t.headers.get("retry-after")),i=t.status>=300&&t.status<400;return new x({op:e,status:t.status,code:a?.error??(i?"undeclared_redirect":`http_${t.status}`),message:a?.error_description??(i?`${e}: the server redirected (${t.status}); the request was not followed, its credentials stay here`:`${e}: ${t.status} ${t.statusText}`.trim()),requestId:a?.request_id??t.headers.get("x-request-id")??void 0,retryAfter:a?.retry_after??(Number.isFinite(r)&&r>0?r:void 0),body:s})}async function ub(e,t){if(!e.body)return"";let n=e.body.getReader(),s=[],a=0;for(;a<t;){let{done:o,value:l}=await n.read();if(o)break;s.push(l),a+=l.byteLength}await n.cancel().catch(()=>{});let r=new Uint8Array(Math.min(a,t)),i=0;for(let o of s){let l=Math.min(o.byteLength,r.byteLength-i);if(r.set(o.subarray(0,l),i),i+=l,i>=r.byteLength)break}return new TextDecoder().decode(r)}function cb(e){return typeof e=="object"&&e!==null&&typeof e.error=="string"}var ka={project:{type:"string",short:"P",value:"project",description:"the project (name or id; org/project when the name is in two organizations)"},env:{type:"string",short:"E",value:"env",description:"the project's environment (slug or ref)"},json:{type:"boolean",description:"print the answer as JSON"},"non-interactive":{type:"boolean",description:"never ask: refuse what would need a question"},yes:{type:"boolean",short:"y",description:"confirm a change to a production environment without asking"},debug:{type:"boolean",description:"print each request the command sends"},help:{type:"boolean",short:"h",description:"show help"}};var y=class extends Error{exitCode;hint;code;reported;constructor(t,n,s={}){super(n),this.name="CliError",this.code=t,this.hint=s.hint,this.exitCode=s.exitCode??1,this.reported=s.reported??!1}};function m(e,t){return new y("usage",e,{hint:t,exitCode:2})}var Sa=class{io;json;constructor(t,n){this.io=t,this.json=n}result(t,n){this.json?this.io.stdout(`${JSON.stringify(t,null,2)}
4
4
  `):n()}line(t=""){this.io.stdout(`${K(t)}
5
5
  `)}note(t){this.io.stderr(`${K(t)}
6
6
  `)}warn(t){this.io.stderr(`warning: ${K(t)}
@@ -9,7 +9,7 @@ var Fy=Object.defineProperty;var tt=(e,t)=>{for(var n in t)Fy(e,n,{get:t[n],enum
9
9
  `);let i;try{i=await this.io.fetch(t,{method:n.method,headers:{...n.headers,...a},body:n.body,signal:n.signal,...s?{}:{duplex:"half"},redirect:"manual"})}catch(l){throw n.signal?.aborted?l:new y("network_error",`${new URL(t).origin} could not be reached: ${l instanceof Error?l.message:String(l)}`)}if(this.debug&&this.io.stderr(`< ${i.status} ${i.headers.get("x-request-id")??""}
10
10
  `),i.status!==503||!s||r>=Pb||!$b.has(await li(i)??""))return i;await i.body?.cancel();let o=Number(i.headers.get("retry-after")??"");await this.io.sleep((Number.isFinite(o)&&o>0?Math.min(o,30):1)*1e3)}}async exchange(t,n,s){let a=await this.token(),r=await this.send(t,n,s,a.value);if(r.status===401&&a.renewable){let i=await this.renew(await this.currentSession());r=await this.send(t,n,s,i.access_token)}return{res:r,renewable:a.renewable}}async answered(t,n,s,a){if(s.status===204)return;let r=await s.text(),i=r===""?void 0:Ab(r);if(s.ok)return i;let o=i??{};throw s.status===401?o.error==="token_not_for_machines"?ep(new URL(this.cloud.studioApi).host):a?Bn():this.tokenRefused("Studio"):new x({op:`${t} ${n}`,status:s.status,code:o.error??`http_${s.status}`,message:o.error_description??`Studio answered ${s.status}`,requestId:o.request_id??s.headers.get("x-request-id")??void 0,body:i})}tokenRefused(t){return(this.io.env.PALBASE_TOKEN??"").startsWith("pbe_")?new y("token_refused",`${t} refused PALBASE_TOKEN, an environment's token: it ended (a few hours at most), it was revoked, or what minted it no longer holds`,{hint:"mint another: palbase env:tokens:create --scope <scope> (an admin), or with the environment's secret key (Studio's POST /environments/{ref}/tokens)"}):new y("token_refused",`${t} refused PALBASE_TOKEN: it was revoked, it ended, or the one who made it no longer holds its role`,{hint:"an admin makes a new one: palbase tokens:create <name>"})}async token(){let t=this.io.env.PALBASE_TOKEN;return t&&t!==""?{value:t,renewable:!1}:{value:(await this.currentSession()).access_token,renewable:!0}}async renew(t){let n=await Xl(this.io,this.cloud,t);return await this.state.writeSession(n),this.session=n,n}async send(t,n,s,a){let r=`${this.cloud.studioApi}${Sb}${n}`;this.debug&&this.io.stderr(`> ${t} ${r}
11
11
  `);try{let i=await this.io.fetch(r,{method:t,headers:{...a===void 0?{}:{authorization:`Bearer ${a}`},accept:"application/json",...s===void 0?{}:{"content-type":"application/json"}},body:s===void 0?void 0:JSON.stringify(s),redirect:"manual"});return this.debug&&this.io.stderr(`< ${i.status} ${i.headers.get("x-request-id")??""}
12
- `),i}catch(i){throw new y("network_error",`Studio (${this.cloud.studioApi}) could not be reached: ${i instanceof Error?i.message:String(i)}`)}}};function ep(e){return new y("token_not_for_machines",`the platform's edge refused PALBASE_TOKEN at ${e}, taking it for a machine's address (token_not_for_machines): the token itself was not refused`,{hint:"nothing is wrong with the token: run this again in a few minutes, and tell Palbase if it lasts"})}async function li(e){let t=await e.clone().json().catch(()=>null),n=t&&typeof t=="object"?t.error:void 0;return typeof n=="string"&&/^(console|token|edge)_/.test(n)?n:void 0}function Ab(e){try{return JSON.parse(e)}catch{return e}}var tp={version:"0.18.6"};var Ta=tp.version;async function ip(e,t,n){let s=new Map(n.map(i=>[i.name,i])),a=e.includes("--json"),r=e.includes("--debug");try{let{name:i,at:o}=Eb(e);if(i===void 0)return e.includes("--version")?(t.stdout(`palbase ${Ta}
12
+ `),i}catch(i){throw new y("network_error",`Studio (${this.cloud.studioApi}) could not be reached: ${i instanceof Error?i.message:String(i)}`)}}};function ep(e){return new y("token_not_for_machines",`the platform's edge refused PALBASE_TOKEN at ${e}, taking it for a machine's address (token_not_for_machines): the token itself was not refused`,{hint:"nothing is wrong with the token: run this again in a few minutes, and tell Palbase if it lasts"})}async function li(e){let t=await e.clone().json().catch(()=>null),n=t&&typeof t=="object"?t.error:void 0;return typeof n=="string"&&/^(console|token|edge)_/.test(n)?n:void 0}function Ab(e){try{return JSON.parse(e)}catch{return e}}var tp={version:"0.19.0"};var Ta=tp.version;async function ip(e,t,n){let s=new Map(n.map(i=>[i.name,i])),a=e.includes("--json"),r=e.includes("--debug");try{let{name:i,at:o}=Eb(e);if(i===void 0)return e.includes("--version")?(t.stdout(`palbase ${Ta}
13
13
  `),0):(t.stdout(rp(n)),e.length===0||e.includes("--help")||e.includes("-h")?0:2);if(i==="help"){let S=e[o+1],$=S===void 0?void 0:s.get(S);if(S!==void 0&&!$)throw np(S,n);return t.stdout($?ap($):rp(n)),0}let l=s.get(i);if(!l)throw np(i,n);let d=[...e.slice(0,o),...e.slice(o+1)];if(d.includes("--help")||d.includes("-h"))return t.stdout(ap(l)),0;let{flags:p,positionals:u}=Cb(l,d),h=l.args??{min:0,max:0};if(u.length<h.min)throw m(`${l.name} needs ${h.min===1?"an argument":`${h.min} arguments`}`,di(l));if(u.length>h.max)throw m(`${l.name} takes ${h.max===0?"no argument":`at most ${h.max}`}: ${JSON.stringify(u.slice(h.max))} is left over`,di(l));let b={project:p.project,env:p.env,json:p.json===!0,nonInteractive:p["non-interactive"]===!0,yes:p.yes===!0,debug:p.debug===!0},w=Bl(t.env),k=new $a(Wl(t.configDir,w)),E={io:t,state:k,out:new Sa(t,b.json),global:b,args:u,flags:p,interactive:t.interactive&&!b.nonInteractive,cloud:w,studio:new Ra(t,w,k,b.debug)};return await l.run(E)??0}catch(i){return jb(i,t,a,r)}}function Eb(e){let t=new Set;for(let[n,s]of Object.entries(ka))s.type==="string"&&(t.add(`--${n}`),s.short&&t.add(`-${s.short}`));for(let n=0;n<e.length;n++){let s=e[n];if(s==="--")return{at:-1};if(t.has(s)){n++;continue}if(!s.startsWith("-"))return{name:s,at:n}}return{at:-1}}function Cb(e,t){let n={...ka,...e.flags??{}},s={};for(let[a,r]of Object.entries(n))s[a]={type:r.type,...r.short?{short:r.short}:{},...r.multiple?{multiple:!0}:{}};try{let{values:a,positionals:r}=Tb({args:t,options:s,strict:!0,allowPositionals:!0});return{flags:a,positionals:r}}catch(a){throw m(a instanceof Error?a.message.replace(/^.*?: /,""):String(a),`palbase help ${e.name}`)}}function jb(e,t,n,s){let a="error",r,i,o=1,l;return e instanceof y?(a=e.code,r=e.message,i=e.hint,o=e.exitCode):e instanceof x?(a=e.code,r=e.message,l=e.requestId):r=e instanceof Error?e.message:String(e),n&&e instanceof y&&e.reported||(n?t.stdout(`${JSON.stringify({error:a,message:r,...i?{hint:i}:{},...l?{request_id:l}:{}},null,2)}
14
14
  `):(t.stderr(`error: ${K(r)}${l?` (request ${K(l)})`:""}
15
15
  `),i&&t.stderr(` ${K(i)}
@@ -0,0 +1,2 @@
1
+ /*! palbase 0.19.0 — Palbase SDK License (see LICENSE) */
2
+ import{a as I}from"../chunks/LCBMI6UP.js";import{a as v,b as P,c as k,e as A,f as T,g as C,h as w,i as S,j as R,k as j,l as E,m as x,n as U}from"../chunks/ZW57VOIW.js";import{a as D,b as G}from"../chunks/Y4THIE6E.js";import{b,c as r,d as f}from"../chunks/Z4YKS2EK.js";import"../chunks/43RXGTTL.js";import"../chunks/RIQJUVZK.js";function B(t){let e=v.client(t),i=P.client(t),s=k.client(t),g=A.client(t),p=T.client(t),l=C.client(t),d=w.client(t),o=S.client(t),n=R.client(t),u=j.client(t),m=E.client(t),c=x.client(t),a=U.client(t);return{ai:{draftAgent:e.draftAgent,listAgents:e.listAgents,getAgent:e.getAgent,putAgent:e.putAgent,deleteAgent:e.deleteAgent,publishAgent:e.publishAgent,rollbackAgent:e.rollbackAgent,listAgentVersions:e.listAgentVersions,listChats:e.listChats,createChat:e.createChat,getChat:e.getChat,deleteChat:e.deleteChat,decideChatApproval:e.decideChatApproval,forkChat:e.forkChat,getChatGoal:e.getChatGoal,setChatGoal:e.setChatGoal,clearChatGoal:e.clearChatGoal,updateChatGoal:e.updateChatGoal,putChatMember:e.putChatMember,deleteChatMember:e.deleteChatMember,listChatMessages:e.listChatMessages,sendChatMessage:e.sendChatMessage,getChatMessageAttachment:e.getChatMessageAttachment,listChatParts:e.listChatParts,putChatPipe:e.putChatPipe,deleteChatPipe:e.deleteChatPipe,sendSubagentMessage:e.sendSubagentMessage,stopSubagent:e.stopSubagent,stopChat:e.stopChat,listTurnToolCalls:e.listTurnToolCalls,getChatToolCall:e.getChatToolCall,answerChatToolCall:e.answerChatToolCall,listChatTurnArtifacts:e.listChatTurnArtifacts,getChatTurnArtifact:e.getChatTurnArtifact,getChatTurnCost:e.getChatTurnCost,startChatVoice:e.startChatVoice,getChatVoice:e.getChatVoice,closeChatVoice:e.closeChatVoice,commandChatVoice:e.commandChatVoice,getChatWorkspaceFile:e.getChatWorkspaceFile,addChatWorkspaceRepo:e.addChatWorkspaceRepo,createEmbeddings:e.createEmbeddings,listEndpoints:e.listEndpoints,putEndpoint:e.putEndpoint,deleteEndpoint:e.deleteEndpoint,createImage:e.createImage,getImage:e.getImage,getImageFile:e.getImageFile,listModels:e.listModels,listProviders:e.listProviders,connectProvider:e.connectProvider,disconnectProvider:e.disconnectProvider,listRepos:e.listRepos,putRepo:e.putRepo,deleteRepo:e.deleteRepo,createResponse:e.createResponse,getResponse:e.getResponse,cancelResponse:e.cancelResponse,followResponse:e.followResponse,getSettings:e.getSettings,putSettings:e.putSettings,getSpend:e.getSpend,askSupport:e.askSupport,listTools:e.listTools,listUsage:e.listUsage},analytics:{listAudiences:i.listAudiences,createAudience:i.createAudience,previewAudience:i.previewAudience,getAudience:i.getAudience,deleteAudience:i.deleteAudience,updateAudience:i.updateAudience,listAudienceMembers:i.listAudienceMembers,alias:i.alias,batch:i.batch,getEventBreakdown:i.getEventBreakdown,capture:i.capture,sendConsoleHistory:i.sendConsoleHistory,getConsoleConfig:i.getConsoleConfig,listConsoleRecords:i.listConsoleRecords,listEventNames:i.listEventNames,listEvents:i.listEvents,getEventTimeline:i.getEventTimeline,runFunnel:i.runFunnel,identify:i.identify,page:i.page,sendPerf:i.sendPerf,listPerfGroups:i.listPerfGroups,getPerfConfig:i.getPerfConfig,getPerfTimeline:i.getPerfTimeline,listRequestLines:i.listRequestLines,getMachineTraffic:i.getMachineTraffic,runRetention:i.runRetention,screen:i.screen,getSettings:i.getSettings,putSettings:i.putSettings,getSummary:i.getSummary,listTraces:i.listTraces,sendTrace:i.sendTrace,sendTraceBatch:i.sendTraceBatch,getTraceHops:i.getTraceHops,listSessionTraces:i.listSessionTraces,getTraceSummary:i.getTraceSummary,getTraceTimeline:i.getTraceTimeline,searchPeople:i.searchPeople,setPersonProperties:i.setPersonProperties,getPerson:i.getPerson,listPersonEvents:i.listPersonEvents,getEventCatalog:i.getEventCatalog,defineEvent:i.defineEvent},auth:{adminVerifyDeviceAssertion:s.adminVerifyDeviceAssertion,adminGetAttestPolicy:s.adminGetAttestPolicy,adminGetAttestObservations:s.adminGetAttestObservations,adminRecordAttestObservations:s.adminRecordAttestObservations,adminListAuditEvents:s.adminListAuditEvents,adminExportAuditEvents:s.adminExportAuditEvents,adminVerifyAuditTrail:s.adminVerifyAuditTrail,adminGetAuthSettings:s.adminGetAuthSettings,adminUpdateAuthSettings:s.adminUpdateAuthSettings,adminGetBreachWatch:s.adminGetBreachWatch,adminListHooks:s.adminListHooks,adminCreateHook:s.adminCreateHook,adminUpdateHook:s.adminUpdateHook,adminDeleteHook:s.adminDeleteHook,adminListHookExecutions:s.adminListHookExecutions,adminListIntegrations:s.adminListIntegrations,adminPutIntegration:s.adminPutIntegration,adminDeleteIntegration:s.adminDeleteIntegration,adminListOAuthClients:s.adminListOAuthClients,adminCreateOAuthClient:s.adminCreateOAuthClient,adminGetOAuthClient:s.adminGetOAuthClient,adminDeleteOAuthClient:s.adminDeleteOAuthClient,adminUpdateOAuthClient:s.adminUpdateOAuthClient,adminListProviders:s.adminListProviders,adminGetPhoneSettings:s.adminGetPhoneSettings,adminUpdatePhoneSettings:s.adminUpdatePhoneSettings,adminToggleProvider:s.adminToggleProvider,adminListRoles:s.adminListRoles,adminUpsertRole:s.adminUpsertRole,adminDeleteRole:s.adminDeleteRole,adminListServiceAccounts:s.adminListServiceAccounts,adminCreateServiceAccount:s.adminCreateServiceAccount,adminGetServiceAccount:s.adminGetServiceAccount,adminRevokeServiceAccount:s.adminRevokeServiceAccount,adminRotateServiceAccount:s.adminRotateServiceAccount,adminListSessions:s.adminListSessions,adminRevokeSession:s.adminRevokeSession,adminListSigningKeys:s.adminListSigningKeys,adminRotateSigningKey:s.adminRotateSigningKey,socialAdminConfig:s.socialAdminConfig,socialCredentialPut:s.socialCredentialPut,socialCredentialDelete:s.socialCredentialDelete,socialProviderPatch:s.socialProviderPatch,adminGetStats:s.adminGetStats,adminSendTestTemplate:s.adminSendTestTemplate,adminListTestUsers:s.adminListTestUsers,adminCreateTestUsers:s.adminCreateTestUsers,adminSetTestUserPhone:s.adminSetTestUserPhone,adminDeleteTestUser:s.adminDeleteTestUser,adminCreateCustomToken:s.adminCreateCustomToken,adminListUsers:s.adminListUsers,adminCreateUser:s.adminCreateUser,adminImportUsers:s.adminImportUsers,adminGetUser:s.adminGetUser,adminDeleteUser:s.adminDeleteUser,adminUpdateUser:s.adminUpdateUser,adminBanUser:s.adminBanUser,adminGetUserConsents:s.adminGetUserConsents,adminRevokeUserCredentials:s.adminRevokeUserCredentials,adminExportUser:s.adminExportUser,adminListUserMfaFactors:s.adminListUserMfaFactors,adminResetUserMfa:s.adminResetUserMfa,adminResetUserPassword:s.adminResetUserPassword,adminListUserRoles:s.adminListUserRoles,adminAssignUserRole:s.adminAssignUserRole,adminRevokeUserRole:s.adminRevokeUserRole,adminRevokeUserSessions:s.adminRevokeUserSessions,adminUnbanUser:s.adminUnbanUser,adminGetInstallationConsents:s.adminGetInstallationConsents,adminRefuseConsents:s.adminRefuseConsents},flags:{getValues:g.getValues,batchUserValues:g.batchUserValues,getDelta:g.getDelta,getEvaluations:g.getEvaluations,listExperiments:g.listExperiments,startExperiment:g.startExperiment,getExperiment:g.getExperiment,getExperimentResults:g.getExperimentResults,stopExperiment:g.stopExperiment,declareExperimentWinner:g.declareExperimentWinner,getCurrentInstallations:g.getCurrentInstallations,getInstallationsDaily:g.getInstallationsDaily,getSnapshot:g.getSnapshot,listDefinitions:g.listDefinitions,getDefinition:g.getDefinition,putDefinition:g.putDefinition,deleteDefinition:g.deleteDefinition,activateTemplates:g.activateTemplates,getActiveTemplate:g.getActiveTemplate,getTemplateCapabilities:g.getTemplateCapabilities,getTemplateDraft:g.getTemplateDraft,createTemplateDraft:g.createTemplateDraft,discardTemplateDraft:g.discardTemplateDraft,putTemplateParameter:g.putTemplateParameter,removeTemplateParameter:g.removeTemplateParameter,reviewTemplateDraft:g.reviewTemplateDraft,publishTemplate:g.publishTemplate,getPublishReceipt:g.getPublishReceipt,restoreTemplateVersion:g.restoreTemplateVersion,listTemplateVersions:g.listTemplateVersions,getTemplateVersion:g.getTemplateVersion,getUserValues:g.getUserValues,putUserValues:g.putUserValues,deleteUserValues:g.deleteUserValues,putUserValue:g.putUserValue,deleteUserValue:g.deleteUserValue},journeys:{listJourneys:p.listJourneys,createJourney:p.createJourney,listPersonRuns:p.listPersonRuns,simulateJourney:p.simulateJourney,validateJourney:p.validateJourney,getJourney:p.getJourney,updateJourney:p.updateJourney,deleteJourney:p.deleteJourney,copyJourney:p.copyJourney,publishJourney:p.publishJourney,listJourneyRuns:p.listJourneyRuns,getJourneyStats:p.getJourneyStats,stopJourney:p.stopJourney,testJourney:p.testJourney},machines:{listMachines:l.listMachines,createMachine:l.createMachine,listMachineSizes:l.listMachineSizes,getMachineNetwork:l.getMachineNetwork,connectGitHub:l.connectGitHub,listInstallations:l.listInstallations,linkInstallation:l.linkInstallation,shareInstallation:l.shareInstallation,unlinkInstallation:l.unlinkInstallation,listRepositories:l.listRepositories,getMachine:l.getMachine,deleteMachine:l.deleteMachine,updateMachine:l.updateMachine,listBuilds:l.listBuilds,deployMachine:l.deployMachine,getBuild:l.getBuild,getBuildLog:l.getBuildLog,rollbackMachine:l.rollbackMachine,listDatabases:l.listDatabases,createDatabase:l.createDatabase,listDatabaseSizes:l.listDatabaseSizes,getDatabase:l.getDatabase,deleteDatabase:l.deleteDatabase,updateDatabase:l.updateDatabase,undeleteDatabase:l.undeleteDatabase,purgeDatabase:l.purgeDatabase,getDatabaseCredentials:l.getDatabaseCredentials,changeDatabasePassword:l.changeDatabasePassword,readMachineLogs:l.readMachineLogs,getMachineMetrics:l.getMachineMetrics,getMachineContract:l.getMachineContract,restoreDatabase:l.restoreDatabase,getDatabaseSchema:l.getDatabaseSchema,getDatabaseMetrics:l.getDatabaseMetrics,queryDatabase:l.queryDatabase,listCrons:l.listCrons,listCronRuns:l.listCronRuns,runCron:l.runCron,pauseCron:l.pauseCron,resumeCron:l.resumeCron,listTasks:l.listTasks,enqueueTask:l.enqueueTask,getTask:l.getTask,cancelTask:l.cancelTask,retryTask:l.retryTask,listTaskTypes:l.listTaskTypes,makeTemplatedTestUsers:l.makeTemplatedTestUsers,templateTestUser:l.templateTestUser,deleteTemplatedTestUser:l.deleteTemplatedTestUser},messaging:{adminAccessLog:d.adminAccessLog,adminListConversations:d.adminListConversations,adminCreateConversation:d.adminCreateConversation,adminGetConversation:d.adminGetConversation,adminDeleteConversation:d.adminDeleteConversation,adminAddMembers:d.adminAddMembers,adminRemoveMember:d.adminRemoveMember,adminListMessages:d.adminListMessages,adminSendMessage:d.adminSendMessage,adminDeleteMessage:d.adminDeleteMessage,adminFileUrl:d.adminFileUrl,adminPutProfile:d.adminPutProfile,adminListReports:d.adminListReports,adminGetReport:d.adminGetReport,adminReportFileUrl:d.adminReportFileUrl,adminResolveReport:d.adminResolveReport,getSettings:d.getSettings,putSettings:d.putSettings,rotateHookSecret:d.rotateHookSecret},notify:{getDeliverability:o.getDeliverability,listDevices:o.listDevices,getDeviceStats:o.getDeviceStats,sendEmail:o.sendEmail,listInAppCampaigns:o.listInAppCampaigns,createInAppCampaign:o.createInAppCampaign,getInAppCampaign:o.getInAppCampaign,putInAppCampaign:o.putInAppCampaign,deleteInAppCampaign:o.deleteInAppCampaign,getInAppCampaignStats:o.getInAppCampaignStats,listInAppTemplates:o.listInAppTemplates,sendInbox:o.sendInbox,listInboxMessages:o.listInboxMessages,listNotifyMessages:o.listNotifyMessages,getNotifyMessage:o.getNotifyMessage,cancelMessage:o.cancelMessage,getMetricsSummary:o.getMetricsSummary,listNotifyProviders:o.listNotifyProviders,putNotifyProvider:o.putNotifyProvider,deleteNotifyProvider:o.deleteNotifyProvider,sendPush:o.sendPush,getNotifySettings:o.getNotifySettings,putNotifySettings:o.putNotifySettings,sendSms:o.sendSms,listEmailTemplates:o.listEmailTemplates,getEmailTemplate:o.getEmailTemplate,putEmailTemplate:o.putEmailTemplate,deleteEmailTemplate:o.deleteEmailTemplate,listPushTemplates:o.listPushTemplates,getPushTemplate:o.getPushTemplate,putPushTemplate:o.putPushTemplate,deletePushTemplate:o.deletePushTemplate,listSmsTemplates:o.listSmsTemplates,getSmsTemplate:o.getSmsTemplate,putSmsTemplate:o.putSmsTemplate,deleteSmsTemplate:o.deleteSmsTemplate,listWhatsAppTemplates:o.listWhatsAppTemplates,getWhatsAppTemplate:o.getWhatsAppTemplate,putWhatsAppTemplate:o.putWhatsAppTemplate,deleteWhatsAppTemplate:o.deleteWhatsAppTemplate,listTopics:o.listTopics,createTopic:o.createTopic,deleteTopic:o.deleteTopic,changeTopic:o.changeTopic,addTopicSubscribers:o.addTopicSubscribers,removeTopicSubscriber:o.removeTopicSubscriber,listUserDevices:o.listUserDevices,getUserPreferences:o.getUserPreferences,setUserPreferences:o.setUserPreferences,startVerification:o.startVerification,checkVerification:o.checkVerification,getWebPushStatus:o.getWebPushStatus,sendWhatsApp:o.sendWhatsApp,listWhatsAppInbound:o.listWhatsAppInbound},purchases:{getAppleAccount:n.getAppleAccount,disconnectApple:n.disconnectApple,createAppleGrant:n.createAppleGrant,getAppleReadiness:n.getAppleReadiness,setXcodeCertificate:n.setXcodeCertificate,clearXcodeCertificate:n.clearXcodeCertificate,getGoogleAccount:n.getGoogleAccount,connectGoogle:n.connectGoogle,disconnectGoogle:n.disconnectGoogle,getCatalog:n.getCatalog,saveCatalog:n.saveCatalog,planCatalog:n.planCatalog,getCatalogPlan:n.getCatalogPlan,confirmCatalogPlan:n.confirmCatalogPlan,declineCatalogPlan:n.declineCatalogPlan,validateCatalog:n.validateCatalog,listCharts:n.listCharts,getChartsOverview:n.getChartsOverview,getChart:n.getChart,getCustomer:n.getCustomer,grantCredits:n.grantCredits,listCreditEntries:n.listCreditEntries,forgiveCredits:n.forgiveCredits,listCustomerGrants:n.listCustomerGrants,grantEntitlement:n.grantEntitlement,revokeGrant:n.revokeGrant,holdSpend:n.holdSpend,setCustomerLimit:n.setCustomerLimit,clearCustomerLimit:n.clearCustomerLimit,grantLimit:n.grantLimit,spend:n.spend,commitSpend:n.commitSpend,extendHold:n.extendHold,releaseSpend:n.releaseSpend,reverseSpend:n.reverseSpend,listExperiments:n.listExperiments,startExperiment:n.startExperiment,getExperiment:n.getExperiment,getExperimentResults:n.getExperimentResults,stopExperiment:n.stopExperiment,declareExperimentWinner:n.declareExperimentWinner,getOfferings:n.getOfferings,listPaywalls:n.listPaywalls,createPaywall:n.createPaywall,listPaywallAssets:n.listPaywallAssets,registerPaywallAsset:n.registerPaywallAsset,deletePaywallAsset:n.deletePaywallAsset,listPaywallTemplates:n.listPaywallTemplates,getPaywallTemplateAsset:n.getPaywallTemplateAsset,validatePaywall:n.validatePaywall,getPaywall:n.getPaywall,deletePaywall:n.deletePaywall,savePaywallDraft:n.savePaywallDraft,publishPaywall:n.publishPaywall,listPaywallVersions:n.listPaywallVersions,getPaywallVersion:n.getPaywallVersion,listPlacements:n.listPlacements,listAttributeKeys:n.listAttributeKeys,setPlacement:n.setPlacement,deletePlacement:n.deletePlacement,recordPaywallExposure:n.recordPaywallExposure,getPlacementPaywall:n.getPlacementPaywall,previewPlacement:n.previewPlacement,getPlacementResults:n.getPlacementResults,getPlacementRules:n.getPlacementRules,setPlacementRules:n.setPlacementRules,getSettings:n.getSettings,updateSettings:n.updateSettings,getStripeAccount:n.getStripeAccount,disconnectStripe:n.disconnectStripe,checkStripeAccount:n.checkStripeAccount,createCheckout:n.createCheckout,createCheckoutRedemption:n.createCheckoutRedemption,createStripeGrant:n.createStripeGrant,createStripeAppInstall:n.createStripeAppInstall,getOfferStats:n.getOfferStats,listCoupons:n.listCoupons,createCoupon:n.createCoupon,getCoupon:n.getCoupon,revokeCoupon:n.revokeCoupon,listCouponCodes:n.listCouponCodes,setXcodeOfferKey:n.setXcodeOfferKey,searchCustomers:n.searchCustomers,getCustomerHistory:n.getCustomerHistory,listCatalogRevisions:n.listCatalogRevisions,getCatalogRevision:n.getCatalogRevision,restoreCatalogRevision:n.restoreCatalogRevision,extendSubscription:n.extendSubscription,refundSubscription:n.refundSubscription,cancelSubscription:n.cancelSubscription},realtime:{broadcast:u.broadcast,getChannels:u.getChannels,putChannels:u.putChannels,getLimits:u.getLimits,putLimits:u.putLimits,revalidate:u.revalidate,writeState:u.writeState,getStats:u.getStats},secrets:{listSecretAudit:m.listSecretAudit,listFieldKeys:m.listFieldKeys,getFieldKeys:m.getFieldKeys,openFields:m.openFields,sealPlaceholder:m.sealPlaceholder,rotateFieldKeys:m.rotateFieldKeys,listTransitKeys:m.listTransitKeys,getTransitKeys:m.getTransitKeys,getTransitPublicKeys:m.getTransitPublicKeys,rotateTransitKeys:m.rotateTransitKeys,retireTransitKey:m.retireTransitKey,listSecrets:m.listSecrets,getEnvironmentValues:m.getEnvironmentValues,getSecret:m.getSecret,putSecret:m.putSecret,deleteSecret:m.deleteSecret,rollbackSecret:m.rollbackSecret,listSecretVersions:m.listSecretVersions},storage:{listBuckets:c.listBuckets,getBucket:c.getBucket,putBucket:c.putBucket,deleteBucket:c.deleteBucket,copyObject:c.copyObject,moveObject:c.moveObject,listObjects:c.listObjects,getObject:c.getObject,putObject:c.putObject,deleteObject:c.deleteObject,headObject:c.headObject,createSignedUrl:c.createSignedUrl,createUploadUrl:c.createUploadUrl,getStorageStats:c.getStorageStats},stores:{listActions:a.listActions,getAction:a.getAction,confirmAction:a.confirmAction,declineAction:a.declineAction,getAppleAccount:a.getAppleAccount,disconnectApple:a.disconnectApple,checkAppleAccount:a.checkAppleAccount,createAppleGrant:a.createAppleGrant,getSandboxReadiness:a.getSandboxReadiness,listSandboxTesters:a.listSandboxTesters,clearSandboxPurchaseHistory:a.clearSandboxPurchaseHistory,updateSandboxTester:a.updateSandboxTester,listApps:a.listApps,listFeedback:a.listFeedback,getFeedback:a.getFeedback,listGroups:a.listGroups,createGroup:a.createGroup,linkApp:a.linkApp,getListing:a.getListing,setListing:a.setListing,planListing:a.planListing,createPackage:a.createPackage,uploadScreenshot:a.uploadScreenshot,getReviewInfo:a.getReviewInfo,setReviewInfo:a.setReviewInfo,getUploadKey:a.getUploadKey,getAppStoreVersion:a.getAppStoreVersion,prepareAppStoreVersion:a.prepareAppStoreVersion,planPhasedRelease:a.planPhasedRelease,planReleaseVersion:a.planReleaseVersion,planSubmitReview:a.planSubmitReview,planWithdrawReview:a.planWithdrawReview,getAppVitals:a.getAppVitals,getAppWebhook:a.getAppWebhook,makeAppWebhook:a.makeAppWebhook,pingAppWebhook:a.pingAppWebhook,getGoogleAccount:a.getGoogleAccount,connectGoogle:a.connectGoogle,disconnectGoogle:a.disconnectGoogle,checkGoogleAccount:a.checkGoogleAccount,deleteGroup:a.deleteGroup,renameGroup:a.renameGroup,addGroupBuild:a.addGroupBuild,listTesters:a.listTesters,setTesters:a.setTesters,listPackages:a.listPackages,getPackage:a.getPackage,planBetaReview:a.planBetaReview,listDeliveries:a.listDeliveries,deliver:a.deliver,getSignedBundleLink:a.getSignedBundleLink,planExpire:a.planExpire,planExportCompliance:a.planExportCompliance,setWhatToTest:a.setWhatToTest,getAppleSession:a.getAppleSession,disconnectAppleSession:a.disconnectAppleSession,checkAppleSession:a.checkAppleSession,createAppleIdGrant:a.createAppleIdGrant,getAppReview:a.getAppReview,getReviewAttachment:a.getReviewAttachment,setReviewDraft:a.setReviewDraft,sendReviewDraft:a.sendReviewDraft,getAppPrivacy:a.getAppPrivacy,setAppPrivacy:a.setAppPrivacy,makeAppRecord:a.makeAppRecord,removeAppRecord:a.removeAppRecord,listMadeAppleKeys:a.listMadeAppleKeys,makeAppleKey:a.makeAppleKey,revokeMadeAppleKey:a.revokeMadeAppleKey,shareAppleSession:a.shareAppleSession,unshareAppleSession:a.unshareAppleSession}}}function M(t){return{orgs:{async list(e){return t.send({op:"orgs.list",method:"GET",path:"/v1/orgs",auth:[["PalbaseBearer"]],answers:{200:"json"},signal:e?.signal})},async get(e){return t.send({op:"orgs.get",method:"GET",path:"/v1/orgs/"+r("orgs.get","id",e.path.id),auth:[["PalbaseBearer"]],answers:{200:"json"},signal:e.signal})},async members(e){return t.send({op:"orgs.members",method:"GET",path:"/v1/orgs/"+r("orgs.members","id",e.path.id)+"/members",auth:[["PalbaseBearer"]],answers:{200:"json"},signal:e.signal})},async auditLog(e){return t.send({op:"orgs.auditLog",method:"GET",path:"/v1/orgs/"+r("orgs.auditLog","id",e.path.id)+"/audit",auth:[["PalbaseBearer"]],answers:{200:"json"},query:e.query,signal:e.signal})}},invitations:{async mine(e){return t.send({op:"invitations.mine",method:"GET",path:"/v1/invitations",auth:[["PalbaseBearer"]],answers:{200:"json"},signal:e?.signal})},async accept(e){return t.send({op:"invitations.accept",method:"POST",path:"/v1/invitations/"+r("invitations.accept","id",e.path.id)+"/accept",auth:[["PalbaseBearer"]],answers:{200:"json"},idempotent:!0,headers:e.headers,signal:e.signal})}},orgWebhooks:{async list(e){return t.send({op:"orgWebhooks.list",method:"GET",path:"/v1/orgs/"+r("orgWebhooks.list","id",e.path.id)+"/webhooks",auth:[["PalbaseBearer"]],answers:{200:"json"},signal:e.signal})},async add(e){return t.send({op:"orgWebhooks.add",method:"POST",path:"/v1/orgs/"+r("orgWebhooks.add","id",e.path.id)+"/webhooks",auth:[["PalbaseBearer"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async remove(e){return t.send({op:"orgWebhooks.remove",method:"DELETE",path:"/v1/orgs/"+r("orgWebhooks.remove","id",e.path.id)+"/webhooks/"+r("orgWebhooks.remove","endpoint",e.path.endpoint),auth:[["PalbaseBearer"]],answers:{204:"empty"},idempotent:!0,headers:e.headers,signal:e.signal})}},projects:{async mine(e){return t.send({op:"projects.mine",method:"GET",path:"/v1/projects",auth:[["PalbaseBearer"]],answers:{200:"json"},signal:e?.signal})},async environmentsMine(e){return t.send({op:"projects.environmentsMine",method:"GET",path:"/v1/environments",auth:[["PalbaseBearer"]],answers:{200:"json"},signal:e?.signal})},async list(e){return t.send({op:"projects.list",method:"GET",path:"/v1/orgs/"+r("projects.list","id",e.path.id)+"/projects",auth:[["PalbaseBearer"]],answers:{200:"json"},signal:e.signal})},async create(e){return t.send({op:"projects.create",method:"POST",path:"/v1/orgs/"+r("projects.create","id",e.path.id)+"/projects",auth:[["PalbaseBearer"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async get(e){return t.send({op:"projects.get",method:"GET",path:"/v1/projects/"+r("projects.get","id",e.path.id),auth:[["PalbaseBearer"]],answers:{200:"json"},signal:e.signal})},async remove(e){return t.send({op:"projects.remove",method:"DELETE",path:"/v1/projects/"+r("projects.remove","id",e.path.id),auth:[["PalbaseBearer"]],answers:{204:"empty"},idempotent:!0,query:e.query,headers:e.headers,signal:e.signal})},async rename(e){return t.send({op:"projects.rename",method:"PATCH",path:"/v1/projects/"+r("projects.rename","id",e.path.id),auth:[["PalbaseBearer"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async addEnvironment(e){return t.send({op:"projects.addEnvironment",method:"POST",path:"/v1/projects/"+r("projects.addEnvironment","id",e.path.id)+"/environments",auth:[["PalbaseBearer"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async environment(e){return t.send({op:"projects.environment",method:"GET",path:"/v1/environments/"+r("projects.environment","ref",e.path.ref),auth:[["PalbaseBearer"]],answers:{200:"json"},signal:e.signal})},async removeEnvironment(e){return t.send({op:"projects.removeEnvironment",method:"DELETE",path:"/v1/environments/"+r("projects.removeEnvironment","ref",e.path.ref),auth:[["PalbaseBearer"]],answers:{204:"empty"},idempotent:!0,query:e.query,headers:e.headers,signal:e.signal})},async renameEnvironment(e){return t.send({op:"projects.renameEnvironment",method:"PATCH",path:"/v1/environments/"+r("projects.renameEnvironment","ref",e.path.ref),auth:[["PalbaseBearer"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async keys(e){return t.send({op:"projects.keys",method:"GET",path:"/v1/environments/"+r("projects.keys","ref",e.path.ref)+"/keys",auth:[["PalbaseBearer"]],answers:{200:"json"},signal:e.signal})},async usage(e){return t.send({op:"projects.usage",method:"GET",path:"/v1/environments/"+r("projects.usage","ref",e.path.ref)+"/usage",auth:[["PalbaseBearer"]],answers:{200:"json"},query:e.query,signal:e.signal})},async personalKey(e){return t.send({op:"projects.personalKey",method:"POST",path:"/v1/environments/"+r("projects.personalKey","ref",e.path.ref)+"/personal-key",auth:[["PalbaseBearer"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async revokePersonalKey(e){return t.send({op:"projects.revokePersonalKey",method:"DELETE",path:"/v1/environments/"+r("projects.revokePersonalKey","ref",e.path.ref)+"/personal-key/"+r("projects.revokePersonalKey","key",e.path.key),auth:[["PalbaseBearer"]],answers:{204:"empty"},idempotent:!0,headers:e.headers,signal:e.signal})},async shareInstallation(e){return t.send({op:"projects.shareInstallation",method:"POST",path:"/v1/environments/"+r("projects.shareInstallation","ref",e.path.ref)+"/github/installations",auth:[["PalbaseBearer"]],answers:{},ownResponse:!0,idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})}},apps:{async list(e){return t.send({op:"apps.list",method:"GET",path:"/v1/projects/"+r("apps.list","id",e.path.id)+"/apps",auth:[["PalbaseBearer"]],answers:{200:"json"},signal:e.signal})},async create(e){return t.send({op:"apps.create",method:"POST",path:"/v1/projects/"+r("apps.create","id",e.path.id)+"/apps",auth:[["PalbaseBearer"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async get(e){return t.send({op:"apps.get",method:"GET",path:"/v1/projects/"+r("apps.get","id",e.path.id)+"/apps/"+r("apps.get","app",e.path.app),auth:[["PalbaseBearer"]],answers:{200:"json"},signal:e.signal})},async remove(e){return t.send({op:"apps.remove",method:"DELETE",path:"/v1/projects/"+r("apps.remove","id",e.path.id)+"/apps/"+r("apps.remove","app",e.path.app),auth:[["PalbaseBearer"]],answers:{200:"json"},idempotent:!0,headers:e.headers,signal:e.signal})},async update(e){return t.send({op:"apps.update",method:"PATCH",path:"/v1/projects/"+r("apps.update","id",e.path.id)+"/apps/"+r("apps.update","app",e.path.app),auth:[["PalbaseBearer"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async restore(e){return t.send({op:"apps.restore",method:"POST",path:"/v1/projects/"+r("apps.restore","id",e.path.id)+"/apps/"+r("apps.restore","app",e.path.app)+"/restore",auth:[["PalbaseBearer"]],answers:{200:"json"},idempotent:!0,headers:e.headers,signal:e.signal})},async setIn(e){return t.send({op:"apps.setIn",method:"PUT",path:"/v1/environments/"+r("apps.setIn","ref",e.path.ref)+"/apps/"+r("apps.setIn","app",e.path.app),auth:[["PalbaseBearer"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async removeFrom(e){return t.send({op:"apps.removeFrom",method:"DELETE",path:"/v1/environments/"+r("apps.removeFrom","ref",e.path.ref)+"/apps/"+r("apps.removeFrom","app",e.path.app),auth:[["PalbaseBearer"]],answers:{204:"empty"},idempotent:!0,headers:e.headers,signal:e.signal})},async config(e){return t.send({op:"apps.config",method:"GET",path:"/v1/environments/"+r("apps.config","ref",e.path.ref)+"/apps/"+r("apps.config","app",e.path.app)+"/config",auth:[["PalbaseBearer"]],answers:{200:"json"},signal:e.signal})}},snippets:{async list(e){return t.send({op:"snippets.list",method:"GET",path:"/v1/environments/"+r("snippets.list","ref",e.path.ref)+"/snippets",auth:[["PalbaseBearer"]],answers:{200:"json"},signal:e.signal})},async create(e){return t.send({op:"snippets.create",method:"POST",path:"/v1/environments/"+r("snippets.create","ref",e.path.ref)+"/snippets",auth:[["PalbaseBearer"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async remove(e){return t.send({op:"snippets.remove",method:"DELETE",path:"/v1/environments/"+r("snippets.remove","ref",e.path.ref)+"/snippets/"+r("snippets.remove","id",e.path.id),auth:[["PalbaseBearer"]],answers:{204:"empty"},idempotent:!0,headers:e.headers,signal:e.signal})},async change(e){return t.send({op:"snippets.change",method:"PATCH",path:"/v1/environments/"+r("snippets.change","ref",e.path.ref)+"/snippets/"+r("snippets.change","id",e.path.id),auth:[["PalbaseBearer"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})}},chartViews:{async list(e){return t.send({op:"chartViews.list",method:"GET",path:"/v1/environments/"+r("chartViews.list","ref",e.path.ref)+"/chart-views",auth:[["PalbaseBearer"]],answers:{200:"json"},signal:e.signal})},async create(e){return t.send({op:"chartViews.create",method:"POST",path:"/v1/environments/"+r("chartViews.create","ref",e.path.ref)+"/chart-views",auth:[["PalbaseBearer"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async remove(e){return t.send({op:"chartViews.remove",method:"DELETE",path:"/v1/environments/"+r("chartViews.remove","ref",e.path.ref)+"/chart-views/"+r("chartViews.remove","id",e.path.id),auth:[["PalbaseBearer"]],answers:{204:"empty"},idempotent:!0,headers:e.headers,signal:e.signal})},async change(e){return t.send({op:"chartViews.change",method:"PATCH",path:"/v1/environments/"+r("chartViews.change","ref",e.path.ref)+"/chart-views/"+r("chartViews.change","id",e.path.id),auth:[["PalbaseBearer"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})}},webhooks:{async list(e){return t.send({op:"webhooks.list",method:"GET",path:"/v1/environments/"+r("webhooks.list","ref",e.path.ref)+"/webhooks",auth:[["PalbaseBearer"]],answers:{200:"json"},signal:e.signal})},async add(e){return t.send({op:"webhooks.add",method:"POST",path:"/v1/environments/"+r("webhooks.add","ref",e.path.ref)+"/webhooks",auth:[["PalbaseBearer"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async deliveries(e){return t.send({op:"webhooks.deliveries",method:"GET",path:"/v1/environments/"+r("webhooks.deliveries","ref",e.path.ref)+"/webhooks/deliveries",auth:[["PalbaseBearer"]],answers:{200:"json"},query:e.query,signal:e.signal})},async redeliver(e){return t.send({op:"webhooks.redeliver",method:"POST",path:"/v1/environments/"+r("webhooks.redeliver","ref",e.path.ref)+"/webhooks/deliveries/"+r("webhooks.redeliver","delivery",e.path.delivery)+"/redeliver",auth:[["PalbaseBearer"]],answers:{200:"json"},idempotent:!0,headers:e.headers,signal:e.signal})},async change(e){return t.send({op:"webhooks.change",method:"PUT",path:"/v1/environments/"+r("webhooks.change","ref",e.path.ref)+"/webhooks/"+r("webhooks.change","endpoint",e.path.endpoint),auth:[["PalbaseBearer"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async remove(e){return t.send({op:"webhooks.remove",method:"DELETE",path:"/v1/environments/"+r("webhooks.remove","ref",e.path.ref)+"/webhooks/"+r("webhooks.remove","endpoint",e.path.endpoint),auth:[["PalbaseBearer"]],answers:{204:"empty"},idempotent:!0,headers:e.headers,signal:e.signal})}},environmentTokens:{async list(e){return t.send({op:"environmentTokens.list",method:"GET",path:"/v1/environments/"+r("environmentTokens.list","ref",e.path.ref)+"/tokens",auth:[["PalbaseBearer"]],answers:{200:"json"},signal:e.signal})},async mint(e){return t.send({op:"environmentTokens.mint",method:"POST",path:"/v1/environments/"+r("environmentTokens.mint","ref",e.path.ref)+"/tokens",auth:[["PalbaseBearer"],[]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async revoke(e){return t.send({op:"environmentTokens.revoke",method:"DELETE",path:"/v1/environments/"+r("environmentTokens.revoke","ref",e.path.ref)+"/tokens/"+r("environmentTokens.revoke","id",e.path.id),auth:[["PalbaseBearer"]],answers:{204:"empty"},idempotent:!0,headers:e.headers,signal:e.signal})}},billing:{async bill(e){return t.send({op:"billing.bill",method:"GET",path:"/v1/orgs/"+r("billing.bill","id",e.path.id)+"/billing",auth:[["PalbaseBearer"]],answers:{200:"json"},signal:e.signal})},async confirm(e){return t.send({op:"billing.confirm",method:"POST",path:"/v1/orgs/"+r("billing.confirm","id",e.path.id)+"/billing/checkout/"+r("billing.confirm","session",e.path.session)+"/confirm",auth:[["PalbaseBearer"]],answers:{200:"json"},idempotent:!0,headers:e.headers,signal:e.signal})},async cards(e){return t.send({op:"billing.cards",method:"GET",path:"/v1/orgs/"+r("billing.cards","id",e.path.id)+"/billing/cards",auth:[["PalbaseBearer"]],answers:{200:"json"},signal:e.signal})},async defaultCard(e){return t.send({op:"billing.defaultCard",method:"PUT",path:"/v1/orgs/"+r("billing.defaultCard","id",e.path.id)+"/billing/cards/"+r("billing.defaultCard","card",e.path.card)+"/default",auth:[["PalbaseBearer"]],answers:{200:"json"},idempotent:!0,headers:e.headers,signal:e.signal})},async removeCard(e){return t.send({op:"billing.removeCard",method:"DELETE",path:"/v1/orgs/"+r("billing.removeCard","id",e.path.id)+"/billing/cards/"+r("billing.removeCard","card",e.path.card),auth:[["PalbaseBearer"]],answers:{200:"json"},idempotent:!0,headers:e.headers,signal:e.signal})},async customer(e){return t.send({op:"billing.customer",method:"GET",path:"/v1/orgs/"+r("billing.customer","id",e.path.id)+"/billing/customer",auth:[["PalbaseBearer"]],answers:{200:"json"},signal:e.signal})},async setCustomer(e){return t.send({op:"billing.setCustomer",method:"PUT",path:"/v1/orgs/"+r("billing.setCustomer","id",e.path.id)+"/billing/customer",auth:[["PalbaseBearer"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async charges(e){return t.send({op:"billing.charges",method:"GET",path:"/v1/orgs/"+r("billing.charges","id",e.path.id)+"/billing/charges",auth:[["PalbaseBearer"]],answers:{200:"json"},query:e.query,signal:e.signal})},async csv(e){return t.send({op:"billing.csv",method:"GET",path:"/v1/orgs/"+r("billing.csv","id",e.path.id)+"/billing/charges.csv",auth:[["PalbaseBearer"]],answers:{},ownResponse:!0,query:e.query,signal:e.signal})},async invoices(e){return t.send({op:"billing.invoices",method:"GET",path:"/v1/orgs/"+r("billing.invoices","id",e.path.id)+"/billing/invoices",auth:[["PalbaseBearer"]],answers:{200:"json"},query:e.query,signal:e.signal})},async transfer(e){return t.send({op:"billing.transfer",method:"POST",path:"/v1/orgs/"+r("billing.transfer","id",e.path.id)+"/billing/transfers",auth:[["PalbaseBearer"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async environment(e){return t.send({op:"billing.environment",method:"GET",path:"/v1/orgs/"+r("billing.environment","id",e.path.id)+"/billing/environments/"+r("billing.environment","ref",e.path.ref),auth:[["PalbaseBearer"]],answers:{200:"json"},signal:e.signal})},async steer(e){return t.send({op:"billing.steer",method:"PATCH",path:"/v1/orgs/"+r("billing.steer","id",e.path.id)+"/billing/environments/"+r("billing.steer","ref",e.path.ref),auth:[["PalbaseBearer"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async topUp(e){return t.send({op:"billing.topUp",method:"POST",path:"/v1/orgs/"+r("billing.topUp","id",e.path.id)+"/billing/environments/"+r("billing.topUp","ref",e.path.ref)+"/topups",auth:[["PalbaseBearer"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async bankTransfer(e){return t.send({op:"billing.bankTransfer",method:"POST",path:"/v1/orgs/"+r("billing.bankTransfer","id",e.path.id)+"/billing/environments/"+r("billing.bankTransfer","ref",e.path.ref)+"/bank-transfers",auth:[["PalbaseBearer"]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})},async ledger(e){return t.send({op:"billing.ledger",method:"GET",path:"/v1/orgs/"+r("billing.ledger","id",e.path.id)+"/billing/environments/"+r("billing.ledger","ref",e.path.ref)+"/ledger",auth:[["PalbaseBearer"]],answers:{200:"json"},query:e.query,signal:e.signal})}},accessRequests:{async request(e){return t.send({op:"accessRequests.request",method:"POST",path:"/v1/access-requests",auth:[["PalbaseBearer"],[]],answers:{200:"json"},idempotent:!0,headers:e.headers,body:{kind:"json",contentType:"application/json",value:e.body},signal:e.signal})}},docs:{async search(e){return t.send({op:"docs.search",method:"GET",path:"/v1/docs/search",auth:[["PalbaseBearer"],[]],answers:{200:"json"},query:e.query,signal:e.signal})}}}}function L(t){let{mint:e,revoke:i}=t;return async s=>{let g=await e(s),p=s.body?.role,l=s.body?.on_behalf_of;if(p===void 0&&l===void 0)return g;let d=g.data,o=[];if(p!==void 0&&d.role!==p&&o.push(`role ${p} (it came back ${d.role==null?"at its minter's":d.role})`),l!==void 0&&d.on_behalf_of!==l.trim()&&o.push("on_behalf_of"),o.length===0)return g;let n;try{await i({path:{ref:s.path.ref,id:String(d.id)}})}catch(m){n=m}let u=`Studio minted the token without the ${o.join(" and ")} asked for \u2014 it is older than this SDK`;throw new b({op:"environmentTokens.mint",status:0,code:"token_role_not_kept",message:n===void 0?`environmentTokens.mint: ${u}; the token (${d.id}) was revoked at once and is not returned \u2014 mint it again once Studio is updated`:`environmentTokens.mint: ${u}, and revoking it failed (${n instanceof Error?n.message:String(n)}) \u2014 revoke token ${d.id} of environment ${s.path.ref} yourself, now`,cause:n})}}var y={pbo_:"an organization's",pbe_:"an environment's"},z=/^[A-Za-z0-9_-]*$/,K=64,h=44;function O(t){if(typeof t!="string"||t==="")return"token is missing: pass an access token, an organization's (pbo_\u2026) or an environment's (pbe_\u2026)";let e=t.slice(0,4);if(!Object.hasOwn(y,e))return`token has the wrong prefix: an access token starts with pbo_ (an organization's) or pbe_ (an environment's)${/^pb_[a-z0-9]+_[cs]/.test(t)?" \u2014 a project key belongs in palbase/server or palbase/web":""}`;let i=t.slice(4);if(i.length!==K)return`token has the wrong length: ${y[e]} access token is ${e} and ${K} characters, this one has ${i.length} after it`;if(!z.test(i))return`token is not ${y[e]} access token: after ${e} come base64url characters alone (A\u2013Z, a\u2013z, 0\u20139, - and _)`;let s=N(i),g=(s[h]<<24|s[h+1]<<16|s[h+2]<<8|s[h+3])>>>0;if($(e,s.subarray(0,h))!==g)return"token's checksum does not match: it was mistyped or cut, or made before access tokens carried one \u2014 make a new token"}function H(t){return O(t)===void 0}function W(t){let e=O(t);if(e!==void 0)throw new TypeError(e)}var J="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function N(t){let e=new Uint8Array(t.length*6/8),i=0,s=0,g=0;for(let p of t)i=i<<6|J.indexOf(p),s+=6,s>=8&&(s-=8,e[g++]=i>>s&255);return e}var V=(()=>{let t=new Uint32Array(256);for(let e=0;e<256;e++){let i=e;for(let s=0;s<8;s++)i=i&1?3988292384^i>>>1:i>>>1;t[e]=i>>>0}return t})();function $(t,e){let i=4294967295;for(let s=0;s<t.length;s++)i=V[(i^t.charCodeAt(s))&255]^i>>>8;for(let s of e)i=V[(i^s)&255]^i>>>8;return(i^4294967295)>>>0}var q="palbase.studio",X="palbase";function Y(){let t=globalThis;return typeof t.window<"u"||typeof t.document<"u"||typeof t.importScripts=="function"||I()}var _=class{domain;#e;#t=new Map;constructor(e){if(Y())throw new TypeError("palbase/cloud runs on a server: its access token opens the organization's projects, so it never goes into a browser, a web worker or a mobile app \u2014 keep it on your server, and have your app call that");W(e?.token);let i=e.domain??q;if(typeof i!="string"||!/^[a-z0-9-]+(\.[a-z0-9-]+)+$/.test(i))throw new TypeError(`domain ${JSON.stringify(i)} is not a domain`);this.domain=i;let s=e.token;this.#e=p=>G(f({baseUrl:p,credentials:{token:s},fetch:e.fetch,solveProofOfWork:!1}),e.retry??D);let g=M(this.#e(`https://palbase.app.${i}`));g.environmentTokens.mint=L(g.environmentTokens),Object.assign(this,g)}project(e){if(typeof e!="string"||!/^[a-z0-9]{1,63}$/.test(e))throw new TypeError(`${JSON.stringify(e)} is not an environment's ref`);let i=this.#t.get(e);return i||(i=B(this.#e(e===X?`https://connect.${this.domain}`:`https://${e}.${this.domain}`)),this.#t.set(e,i)),i}};export{q as DEFAULT_DOMAIN,_ as PalbaseCloud,b as PalbaseError,H as tokenIsWellFormed};
package/dist/refuse/ai.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! palbase 0.18.6 — Palbase SDK License (see LICENSE) */
1
+ /*! palbase 0.19.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");
@@ -1,2 +1,2 @@
1
- /*! palbase 0.18.6 — Palbase SDK License (see LICENSE) */
1
+ /*! palbase 0.19.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)");
@@ -0,0 +1,2 @@
1
+ /*! palbase 0.19.0 — Palbase SDK License (see LICENSE) */
2
+ throw new Error("palbase/cloud is for servers: its access token opens the organization's projects, so it belongs on your server and never in a browser or a mobile app \u2014 have your app call your server");
@@ -1,2 +1,2 @@
1
- /*! palbase 0.18.6 — Palbase SDK License (see LICENSE) */
1
+ /*! palbase 0.19.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");
@@ -1,2 +1,2 @@
1
- /*! palbase 0.18.6 — 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/E4CPOSFA.js";import{a as c,b as d}from"../chunks/6JA355QW.js";import"../chunks/Q2O72MGS.js";import"../chunks/Y76SPW2M.js";import{n as b}from"../chunks/IO3G5VIC.js";import"../chunks/4HYASQT5.js";import{b as a}from"../chunks/RGZZCQMZ.js";import"../chunks/NIDBDL7O.js";import"../chunks/U4R3KQT6.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};
1
+ /*! palbase 0.19.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/424IEUQX.js";import{a as c,b as d}from"../chunks/TOPRHPT6.js";import"../chunks/QOUBSZM4.js";import"../chunks/LCBMI6UP.js";import{o as b}from"../chunks/ZW57VOIW.js";import"../chunks/Y4THIE6E.js";import{b as a}from"../chunks/Z4YKS2EK.js";import"../chunks/43RXGTTL.js";import"../chunks/RIQJUVZK.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};
@@ -1,2 +1,2 @@
1
- /*! palbase 0.18.6 — Palbase SDK License (see LICENSE) */
2
- import{a,b,c,d,e}from"../chunks/OL33SRTB.js";import"../chunks/6JA355QW.js";import"../chunks/NIDBDL7O.js";import"../chunks/U4R3KQT6.js";export{b as TestApiError,e as api,c as createTestApi,a as testFields,d as testRun};
1
+ /*! palbase 0.19.0 — Palbase SDK License (see LICENSE) */
2
+ import{a,b,c,d,e}from"../chunks/B6OLQP6W.js";import"../chunks/TOPRHPT6.js";import"../chunks/43RXGTTL.js";import"../chunks/RIQJUVZK.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.18.6 — Palbase SDK License (see LICENSE) */
2
- import{a as I,b as j,c as q,d as G,e as D,f as N,g as U,h as F,i as B,j as H,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/5N36M3Y3.js";import{a as _,b as Q,f as z}from"../chunks/S76H65KW.js";import"../chunks/RUE6N2T6.js";import"../chunks/ARDQJVIP.js";import"../chunks/6HESVOSN.js";import{b as E,c as T,d as O,f as x,g as A,j as R,k as V,l as $,m as S,o as v}from"../chunks/Q2O72MGS.js";import"../chunks/L4SDE4IC.js";import"../chunks/IO3G5VIC.js";import"../chunks/4HYASQT5.js";import{b as M}from"../chunks/RGZZCQMZ.js";import"../chunks/NIDBDL7O.js";import"../chunks/U4R3KQT6.js";var ce="oai-events";async function de(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 p=ye(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 pe(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: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",d),u(),t?.aborted?t.reason:n}}function pe(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=(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(l[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 L of k)h(L,g,y)}let P=i(a.properties);if(P)for(let[b,k]of Object.entries(P))h(k,`${g}/${S(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(l[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(...f(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=f(n.schema,`/query/${S(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?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 A(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,d)=>R(f,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):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 $(f,u,m)})}}export{U as Analytics,_ as BackendError,G as Channel,F as Consent,ne as ConversationList,oe as ConversationView,re as DeletedGroupList,Z as Flags,z as GatewayError,J as InApp,B as Inbox,N as Installation,te as Messaging,W as Notify,M as PalbaseError,X as Purchases,D as RealtimeSocket,H as SESSION_START,ae as ScheduledList,I as SessionChangedError,se as ThreadView,K as WebPush,de as connectVoice,ie as createClient,me as encryptedCall,ee as indexedDBKeyValue,Q as isBackendError,q as localStore,j as memoryStore,Y as redemptionToken};
1
+ /*! palbase 0.19.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 N,g as U,h as F,i as B,j as H,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/WHKAPZX7.js";import{a as _,b as Q,f as z}from"../chunks/2XM3DQXS.js";import"../chunks/26R7KNH7.js";import"../chunks/SGASB5G4.js";import"../chunks/V2GWROU3.js";import"../chunks/F5CWCOSS.js";import{b as E,c as T,d as O,f as x,g as A,j as R,k as V,l as $,m as S,o as v}from"../chunks/QOUBSZM4.js";import"../chunks/ZW57VOIW.js";import"../chunks/Y4THIE6E.js";import{b as M}from"../chunks/Z4YKS2EK.js";import"../chunks/43RXGTTL.js";import"../chunks/RIQJUVZK.js";var ce="oai-events";async function de(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 p=ye(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 pe(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: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",d),u(),t?.aborted?t.reason:n}}function pe(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=(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(l[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 L of k)h(L,g,y)}let P=i(a.properties);if(P)for(let[b,k]of Object.entries(P))h(k,`${g}/${S(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(l[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(...f(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=f(n.schema,`/query/${S(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?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 A(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,d)=>R(f,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):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 $(f,u,m)})}}export{U as Analytics,_ as BackendError,G as Channel,F as Consent,ne as ConversationList,oe as ConversationView,re as DeletedGroupList,Z as Flags,z as GatewayError,J as InApp,B as Inbox,N as Installation,te as Messaging,W as Notify,M as PalbaseError,X as Purchases,D as RealtimeSocket,H as SESSION_START,ae as ScheduledList,I as SessionChangedError,se as ThreadView,K as WebPush,de as connectVoice,ie as createClient,me as encryptedCall,ee as indexedDBKeyValue,Q as isBackendError,q as localStore,j as memoryStore,Y as redemptionToken};
@@ -1,2 +1,2 @@
1
- /*! palbase 0.18.6 — Palbase SDK License (see LICENSE) */
2
- import{a as i}from"../chunks/ARDQJVIP.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/6HESVOSN.js";import"../chunks/U4R3KQT6.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};
1
+ /*! palbase 0.19.0 — Palbase SDK License (see LICENSE) */
2
+ import{a as i}from"../chunks/V2GWROU3.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/F5CWCOSS.js";import"../chunks/RIQJUVZK.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.18.6 — Palbase SDK License (see LICENSE) */
2
- import{c as e,d as r,i as t}from"../chunks/S76H65KW.js";import"../chunks/Q2O72MGS.js";import"../chunks/L4SDE4IC.js";import"../chunks/4HYASQT5.js";import"../chunks/RGZZCQMZ.js";import"../chunks/NIDBDL7O.js";import"../chunks/U4R3KQT6.js";export{e as RESERVED_CLIENT_NAMES,t as __registerBackend,r as isClientName};
1
+ /*! palbase 0.19.0 — Palbase SDK License (see LICENSE) */
2
+ import{c as e,d as r,i as t}from"../chunks/2XM3DQXS.js";import"../chunks/26R7KNH7.js";import"../chunks/QOUBSZM4.js";import"../chunks/Y4THIE6E.js";import"../chunks/Z4YKS2EK.js";import"../chunks/43RXGTTL.js";import"../chunks/RIQJUVZK.js";export{e as RESERVED_CLIENT_NAMES,t as __registerBackend,r as isClientName};
@@ -1,2 +1,2 @@
1
- /*! palbase 0.18.6 — 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/RUE6N2T6.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/6HESVOSN.js";import"../chunks/RGZZCQMZ.js";import"../chunks/NIDBDL7O.js";import"../chunks/U4R3KQT6.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};
1
+ /*! palbase 0.19.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/SGASB5G4.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/F5CWCOSS.js";import"../chunks/Z4YKS2EK.js";import"../chunks/43RXGTTL.js";import"../chunks/RIQJUVZK.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};
@@ -1,2 +1,2 @@
1
- /*! palbase 0.18.6 — Palbase SDK License (see LICENSE) */
1
+ /*! palbase 0.19.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.18.6 — Palbase SDK License (see LICENSE) */
2
- import{x as f}from"../chunks/5N36M3Y3.js";import"../chunks/S76H65KW.js";import"../chunks/RUE6N2T6.js";import"../chunks/ARDQJVIP.js";import"../chunks/6HESVOSN.js";import"../chunks/Q2O72MGS.js";import"../chunks/L4SDE4IC.js";import"../chunks/IO3G5VIC.js";import"../chunks/4HYASQT5.js";import"../chunks/RGZZCQMZ.js";import"../chunks/NIDBDL7O.js";import"../chunks/U4R3KQT6.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};
1
+ /*! palbase 0.19.0 — Palbase SDK License (see LICENSE) */
2
+ import{x as f}from"../chunks/WHKAPZX7.js";import"../chunks/2XM3DQXS.js";import"../chunks/26R7KNH7.js";import"../chunks/SGASB5G4.js";import"../chunks/V2GWROU3.js";import"../chunks/F5CWCOSS.js";import"../chunks/QOUBSZM4.js";import"../chunks/ZW57VOIW.js";import"../chunks/Y4THIE6E.js";import"../chunks/Z4YKS2EK.js";import"../chunks/43RXGTTL.js";import"../chunks/RIQJUVZK.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.18.6 — Palbase SDK License (see LICENSE) */
2
- import"../chunks/U4R3KQT6.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:
1
+ /*! palbase 0.19.0 — Palbase SDK License (see LICENSE) */
2
+ import"../chunks/RIQJUVZK.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,7 +1,7 @@
1
1
  {
2
2
  "name": "palbase",
3
- "version": "0.18.6",
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).",
3
+ "version": "0.19.0",
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",
7
7
  "keywords": [
@@ -28,7 +28,9 @@
28
28
  "engines": {
29
29
  "node": ">=22"
30
30
  },
31
- "sideEffects": false,
31
+ "sideEffects": [
32
+ "./dist/refuse/*.js"
33
+ ],
32
34
  "bin": {
33
35
  "palbase": "./dist/cli.js"
34
36
  },
@@ -70,6 +72,18 @@
70
72
  "worker": "./dist/server/index.js",
71
73
  "default": "./dist/server/index.js"
72
74
  },
75
+ "./cloud": {
76
+ "types": "./types/cloud/src/index.d.ts",
77
+ "node": "./dist/cloud/index.js",
78
+ "bun": "./dist/cloud/index.js",
79
+ "deno": "./dist/cloud/index.js",
80
+ "workerd": "./dist/cloud/index.js",
81
+ "edge-light": "./dist/cloud/index.js",
82
+ "react-native": "./dist/refuse/cloud.js",
83
+ "browser": "./dist/refuse/cloud.js",
84
+ "worker": "./dist/cloud/index.js",
85
+ "default": "./dist/cloud/index.js"
86
+ },
73
87
  "./ai": {
74
88
  "types": "./types/ai/src/index.d.ts",
75
89
  "node": "./dist/ai/index.js",
@@ -135,7 +149,7 @@
135
149
  "dependencies": {
136
150
  "@types/node": "26.6.4",
137
151
  "bun-types": "1.4.2",
138
- "palgres": "0.18.6",
152
+ "palgres": "0.19.0",
139
153
  "reflect-metadata": "^0.2.2",
140
154
  "typescript": "~6.0.3",
141
155
  "zod": "^4.6.5"
@@ -0,0 +1,23 @@
1
+ import { type RetryPolicy } from '../../internal/src/retry.js';
2
+ import { type Fetch } from '../../internal/src/transport.js';
3
+ import { type Project } from './generated/project.js';
4
+ import * as studio from './generated/studio.js';
5
+ export interface CloudOptions {
6
+ /** An access token, an organization's (pbo_…) or an environment's (pbe_…), from the server's environment. */
7
+ token: string;
8
+ /** The platform's domain (default palbase.studio): Studio's API answers at palbase.app.<domain>, an environment at <ref>.<domain>. */
9
+ domain?: string;
10
+ fetch?: Fetch;
11
+ retry?: RetryPolicy;
12
+ }
13
+ export declare const DEFAULT_DOMAIN = "palbase.studio";
14
+ export interface PalbaseCloud extends studio.Client {
15
+ }
16
+ export declare class PalbaseCloud {
17
+ #private;
18
+ /** The platform's domain the calls go to. */
19
+ readonly domain: string;
20
+ constructor(opts: CloudOptions);
21
+ /** An environment of a project, by its ref: its modules' calls an access token makes, at https://<ref>.<domain>. */
22
+ project(ref: string): Project;
23
+ }
@@ -0,0 +1,19 @@
1
+ import * as modules from '../../../internal/src/modules/index.js';
2
+ import type { Transport } from '../../../internal/src/transport.js';
3
+ /** A project's environment as an access token reaches it: each module's operations under the paths the edge opens to one, a server's calls. */
4
+ export interface Project {
5
+ ai: Pick<modules.ai.Client, "draftAgent" | "listAgents" | "getAgent" | "putAgent" | "deleteAgent" | "publishAgent" | "rollbackAgent" | "listAgentVersions" | "listChats" | "createChat" | "getChat" | "deleteChat" | "decideChatApproval" | "forkChat" | "getChatGoal" | "setChatGoal" | "clearChatGoal" | "updateChatGoal" | "putChatMember" | "deleteChatMember" | "listChatMessages" | "sendChatMessage" | "getChatMessageAttachment" | "listChatParts" | "putChatPipe" | "deleteChatPipe" | "sendSubagentMessage" | "stopSubagent" | "stopChat" | "listTurnToolCalls" | "getChatToolCall" | "answerChatToolCall" | "listChatTurnArtifacts" | "getChatTurnArtifact" | "getChatTurnCost" | "startChatVoice" | "getChatVoice" | "closeChatVoice" | "commandChatVoice" | "getChatWorkspaceFile" | "addChatWorkspaceRepo" | "createEmbeddings" | "listEndpoints" | "putEndpoint" | "deleteEndpoint" | "createImage" | "getImage" | "getImageFile" | "listModels" | "listProviders" | "connectProvider" | "disconnectProvider" | "listRepos" | "putRepo" | "deleteRepo" | "createResponse" | "getResponse" | "cancelResponse" | "followResponse" | "getSettings" | "putSettings" | "getSpend" | "askSupport" | "listTools" | "listUsage">;
6
+ analytics: Pick<modules.analytics.Client, "listAudiences" | "createAudience" | "previewAudience" | "getAudience" | "deleteAudience" | "updateAudience" | "listAudienceMembers" | "alias" | "batch" | "getEventBreakdown" | "capture" | "sendConsoleHistory" | "getConsoleConfig" | "listConsoleRecords" | "listEventNames" | "listEvents" | "getEventTimeline" | "runFunnel" | "identify" | "page" | "sendPerf" | "listPerfGroups" | "getPerfConfig" | "getPerfTimeline" | "listRequestLines" | "getMachineTraffic" | "runRetention" | "screen" | "getSettings" | "putSettings" | "getSummary" | "listTraces" | "sendTrace" | "sendTraceBatch" | "getTraceHops" | "listSessionTraces" | "getTraceSummary" | "getTraceTimeline" | "searchPeople" | "setPersonProperties" | "getPerson" | "listPersonEvents" | "getEventCatalog" | "defineEvent">;
7
+ auth: Pick<modules.auth.Client, "adminVerifyDeviceAssertion" | "adminGetAttestPolicy" | "adminGetAttestObservations" | "adminRecordAttestObservations" | "adminListAuditEvents" | "adminExportAuditEvents" | "adminVerifyAuditTrail" | "adminGetAuthSettings" | "adminUpdateAuthSettings" | "adminGetBreachWatch" | "adminListHooks" | "adminCreateHook" | "adminUpdateHook" | "adminDeleteHook" | "adminListHookExecutions" | "adminListIntegrations" | "adminPutIntegration" | "adminDeleteIntegration" | "adminListOAuthClients" | "adminCreateOAuthClient" | "adminGetOAuthClient" | "adminDeleteOAuthClient" | "adminUpdateOAuthClient" | "adminListProviders" | "adminGetPhoneSettings" | "adminUpdatePhoneSettings" | "adminToggleProvider" | "adminListRoles" | "adminUpsertRole" | "adminDeleteRole" | "adminListServiceAccounts" | "adminCreateServiceAccount" | "adminGetServiceAccount" | "adminRevokeServiceAccount" | "adminRotateServiceAccount" | "adminListSessions" | "adminRevokeSession" | "adminListSigningKeys" | "adminRotateSigningKey" | "socialAdminConfig" | "socialCredentialPut" | "socialCredentialDelete" | "socialProviderPatch" | "adminGetStats" | "adminSendTestTemplate" | "adminListTestUsers" | "adminCreateTestUsers" | "adminSetTestUserPhone" | "adminDeleteTestUser" | "adminCreateCustomToken" | "adminListUsers" | "adminCreateUser" | "adminImportUsers" | "adminGetUser" | "adminDeleteUser" | "adminUpdateUser" | "adminBanUser" | "adminGetUserConsents" | "adminRevokeUserCredentials" | "adminExportUser" | "adminListUserMfaFactors" | "adminResetUserMfa" | "adminResetUserPassword" | "adminListUserRoles" | "adminAssignUserRole" | "adminRevokeUserRole" | "adminRevokeUserSessions" | "adminUnbanUser" | "adminGetInstallationConsents" | "adminRefuseConsents">;
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
+ journeys: Pick<modules.journeys.Client, "listJourneys" | "createJourney" | "listPersonRuns" | "simulateJourney" | "validateJourney" | "getJourney" | "updateJourney" | "deleteJourney" | "copyJourney" | "publishJourney" | "listJourneyRuns" | "getJourneyStats" | "stopJourney" | "testJourney">;
10
+ machines: Pick<modules.machines.Client, "listMachines" | "createMachine" | "listMachineSizes" | "getMachineNetwork" | "connectGitHub" | "listInstallations" | "linkInstallation" | "shareInstallation" | "unlinkInstallation" | "listRepositories" | "getMachine" | "deleteMachine" | "updateMachine" | "listBuilds" | "deployMachine" | "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">;
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">;
12
+ notify: Pick<modules.notify.Client, "getDeliverability" | "listDevices" | "getDeviceStats" | "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" | "listTopics" | "createTopic" | "deleteTopic" | "changeTopic" | "addTopicSubscribers" | "removeTopicSubscriber" | "listUserDevices" | "getUserPreferences" | "setUserPreferences" | "startVerification" | "checkVerification" | "getWebPushStatus" | "sendWhatsApp" | "listWhatsAppInbound">;
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
+ realtime: Pick<modules.realtime.Client, "broadcast" | "getChannels" | "putChannels" | "getLimits" | "putLimits" | "revalidate" | "writeState" | "getStats">;
15
+ secrets: Pick<modules.secrets.Client, "listSecretAudit" | "listFieldKeys" | "getFieldKeys" | "openFields" | "sealPlaceholder" | "rotateFieldKeys" | "listTransitKeys" | "getTransitKeys" | "getTransitPublicKeys" | "rotateTransitKeys" | "retireTransitKey" | "listSecrets" | "getEnvironmentValues" | "getSecret" | "putSecret" | "deleteSecret" | "rollbackSecret" | "listSecretVersions">;
16
+ storage: Pick<modules.storage.Client, "listBuckets" | "getBucket" | "putBucket" | "deleteBucket" | "copyObject" | "moveObject" | "listObjects" | "getObject" | "putObject" | "deleteObject" | "headObject" | "createSignedUrl" | "createUploadUrl" | "getStorageStats">;
17
+ stores: Pick<modules.stores.Client, "listActions" | "getAction" | "confirmAction" | "declineAction" | "getAppleAccount" | "disconnectApple" | "checkAppleAccount" | "createAppleGrant" | "getSandboxReadiness" | "listSandboxTesters" | "clearSandboxPurchaseHistory" | "updateSandboxTester" | "listApps" | "listFeedback" | "getFeedback" | "listGroups" | "createGroup" | "linkApp" | "getListing" | "setListing" | "planListing" | "createPackage" | "uploadScreenshot" | "getReviewInfo" | "setReviewInfo" | "getUploadKey" | "getAppStoreVersion" | "prepareAppStoreVersion" | "planPhasedRelease" | "planReleaseVersion" | "planSubmitReview" | "planWithdrawReview" | "getAppVitals" | "getAppWebhook" | "makeAppWebhook" | "pingAppWebhook" | "getGoogleAccount" | "connectGoogle" | "disconnectGoogle" | "checkGoogleAccount" | "deleteGroup" | "renameGroup" | "addGroupBuild" | "listTesters" | "setTesters" | "listPackages" | "getPackage" | "planBetaReview" | "listDeliveries" | "deliver" | "getSignedBundleLink" | "planExpire" | "planExportCompliance" | "setWhatToTest" | "getAppleSession" | "disconnectAppleSession" | "checkAppleSession" | "createAppleIdGrant" | "getAppReview" | "getReviewAttachment" | "setReviewDraft" | "sendReviewDraft" | "getAppPrivacy" | "setAppPrivacy" | "makeAppRecord" | "removeAppRecord" | "listMadeAppleKeys" | "makeAppleKey" | "revokeMadeAppleKey" | "shareAppleSession" | "unshareAppleSession">;
18
+ }
19
+ export declare function project(t: Transport): Project;