palbase 0.21.0 → 0.23.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 (58) hide show
  1. package/dist/ai/index.js +2 -2
  2. package/dist/backend/engine.js +2 -2
  3. package/dist/backend/env.js +1 -1
  4. package/dist/backend/index.js +11 -11
  5. package/dist/backend/stack.js +1 -1
  6. package/dist/backend/test.js +2 -2
  7. package/dist/chunks/{6B2JVMVC.js → 2TXIGYOJ.js} +1 -1
  8. package/dist/chunks/{BC7DKAEV.js → 4HAHFRWH.js} +2 -2
  9. package/dist/chunks/5Q3GX7V7.js +22 -0
  10. package/dist/chunks/{LHLXKWXT.js → ASHJUFAR.js} +2 -2
  11. package/dist/chunks/{UTZFJM2O.js → BUZEU3KO.js} +2 -2
  12. package/dist/chunks/{LHC3VBGV.js → CNM6KHAV.js} +1 -1
  13. package/dist/chunks/{3MPGMDIO.js → CYQ5IWPO.js} +1 -1
  14. package/dist/chunks/{Y3KNVE2U.js → EPLCUBM7.js} +1 -1
  15. package/dist/chunks/{XZY2DTL7.js → GRMAYURX.js} +2 -2
  16. package/dist/chunks/{5BNYK6GP.js → GUJW2U4D.js} +1 -1
  17. package/dist/chunks/GXOAVCC5.js +21 -0
  18. package/dist/chunks/{RTL4OAKC.js → IPHVAOYL.js} +1 -1
  19. package/dist/chunks/{BQTZYHJN.js → JEBQEIT2.js} +2 -2
  20. package/dist/chunks/{BYKIJBPE.js → KSRQ5B2V.js} +2 -2
  21. package/dist/chunks/{PI2NU4TV.js → MQJN2IGB.js} +2 -2
  22. package/dist/chunks/{PKYERPHS.js → QRRNK56K.js} +2 -2
  23. package/dist/chunks/{YALT2FTV.js → RRS3QIHN.js} +2 -2
  24. package/dist/chunks/{23M37HPW.js → RZE7ZGC5.js} +2 -2
  25. package/dist/chunks/{TUJQKUDT.js → SI3QKQTV.js} +2 -2
  26. package/dist/chunks/U7YF4HAG.js +18 -0
  27. package/dist/chunks/{7LCTRRHG.js → X2IT755X.js} +1 -1
  28. package/dist/chunks/{SIIBIKCD.js → YCVPM3S4.js} +2 -2
  29. package/dist/chunks/{QZMFPTXQ.js → ZWM2JBGV.js} +2 -2
  30. package/dist/cli.js +130 -126
  31. package/dist/cloud/index.js +2 -2
  32. package/dist/refuse/ai.js +1 -1
  33. package/dist/refuse/backend.js +1 -1
  34. package/dist/refuse/cloud.js +1 -1
  35. package/dist/refuse/server.js +1 -1
  36. package/dist/server/index.js +2 -2
  37. package/dist/server/testing.js +2 -2
  38. package/dist/web/index.js +2 -2
  39. package/dist/web/message.js +2 -2
  40. package/dist/web/palbe.js +2 -2
  41. package/dist/web/paywall.js +2 -2
  42. package/dist/web/push-sw.js +1 -1
  43. package/dist/web/ssr.js +2 -2
  44. package/dist/web/vite.js +2 -2
  45. package/package.json +2 -2
  46. package/types/ai/src/chats.d.ts +20 -1
  47. package/types/ai/src/index.d.ts +2 -2
  48. package/types/ai/src/tools.d.ts +20 -0
  49. package/types/backend/src/attest.d.ts +18 -2
  50. package/types/backend/src/bootstrap.d.ts +2 -4
  51. package/types/backend/src/database.d.ts +12 -2
  52. package/types/backend/src/engine.d.ts +10 -3
  53. package/types/backend/src/index.d.ts +1 -1
  54. package/types/internal/src/modules/ai.d.ts +46 -2
  55. package/types/web/src/notify.d.ts +44 -2
  56. package/dist/chunks/DEMLN2MO.js +0 -18
  57. package/dist/chunks/PJLACUYP.js +0 -22
  58. package/dist/chunks/TACI6JAQ.js +0 -21
@@ -1,2 +1,2 @@
1
- /*! palbase 0.21.0 — Palbase SDK License (see LICENSE) */
2
- import{a as I}from"../chunks/RTL4OAKC.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/LHLXKWXT.js";import{a as D,b as G}from"../chunks/BQTZYHJN.js";import{b,c as r,d as f}from"../chunks/XZY2DTL7.js";import"../chunks/3MPGMDIO.js";import"../chunks/5BNYK6GP.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,deleteMyDevice:o.deleteMyDevice,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};
1
+ /*! palbase 0.23.0 — Palbase SDK License (see LICENSE) */
2
+ import{a as I}from"../chunks/IPHVAOYL.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/ASHJUFAR.js";import{a as D,b as G}from"../chunks/JEBQEIT2.js";import{b,c as r,d as f}from"../chunks/GRMAYURX.js";import"../chunks/CYQ5IWPO.js";import"../chunks/GUJW2U4D.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,deleteMyDevice:o.deleteMyDevice,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.21.0 — Palbase SDK License (see LICENSE) */
1
+ /*! palbase 0.23.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.21.0 — Palbase SDK License (see LICENSE) */
1
+ /*! palbase 0.23.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)");
@@ -1,2 +1,2 @@
1
- /*! palbase 0.21.0 — Palbase SDK License (see LICENSE) */
1
+ /*! palbase 0.23.0 — Palbase SDK License (see LICENSE) */
2
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.21.0 — Palbase SDK License (see LICENSE) */
1
+ /*! palbase 0.23.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.21.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/BC7DKAEV.js";import{a as c,b as d}from"../chunks/6B2JVMVC.js";import"../chunks/Y3KNVE2U.js";import"../chunks/RTL4OAKC.js";import{o as b}from"../chunks/LHLXKWXT.js";import"../chunks/BQTZYHJN.js";import{b as a}from"../chunks/XZY2DTL7.js";import"../chunks/3MPGMDIO.js";import"../chunks/5BNYK6GP.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.23.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/4HAHFRWH.js";import{a as c,b as d}from"../chunks/2TXIGYOJ.js";import"../chunks/EPLCUBM7.js";import"../chunks/IPHVAOYL.js";import{o as b}from"../chunks/ASHJUFAR.js";import"../chunks/JEBQEIT2.js";import{b as a}from"../chunks/GRMAYURX.js";import"../chunks/CYQ5IWPO.js";import"../chunks/GUJW2U4D.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.21.0 — Palbase SDK License (see LICENSE) */
2
- import{a,b,c,d,e}from"../chunks/YALT2FTV.js";import"../chunks/6B2JVMVC.js";import"../chunks/3MPGMDIO.js";import"../chunks/5BNYK6GP.js";export{b as TestApiError,e as api,c as createTestApi,a as testFields,d as testRun};
1
+ /*! palbase 0.23.0 — Palbase SDK License (see LICENSE) */
2
+ import{a,b,c,d,e}from"../chunks/RRS3QIHN.js";import"../chunks/2TXIGYOJ.js";import"../chunks/CYQ5IWPO.js";import"../chunks/GUJW2U4D.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.21.0 — Palbase SDK License (see LICENSE) */
2
- import{a as I,b as j,c as q,d as G,e as D,f as H,g as N,h as U,i as F,j as B,k as J,l as K,m as W,n as X,o as Y,p as Z,q as ee,r as te,s as ne,t as re,u as oe,v as se,w as ae,x as ie}from"../chunks/PJLACUYP.js";import{a as _,b as Q,f as z}from"../chunks/SIIBIKCD.js";import"../chunks/UTZFJM2O.js";import"../chunks/PKYERPHS.js";import"../chunks/PI2NU4TV.js";import"../chunks/7LCTRRHG.js";import{b as S,c as T,d as O,f as x,g as R,j as A,k as V,l as M,m as E,o as v}from"../chunks/Y3KNVE2U.js";import"../chunks/LHLXKWXT.js";import"../chunks/BQTZYHJN.js";import{b as L}from"../chunks/XZY2DTL7.js";import"../chunks/3MPGMDIO.js";import"../chunks/5BNYK6GP.js";var ce="oai-events";async function pe(e){if(typeof e?.start!="function")throw new TypeError("connectVoice: start(sdp) is the round trip to the app's backend, which starts the voice (chats.voice.start) and answers { id, sdp }");let r=e.rtc??le(),t=e.signal;t?.throwIfAborted();let l=e.audio??ue(),f=e.microphone===void 0,c=e.microphone??await r.getUserMedia({audio:!0});if(t?.aborted){if(f)for(let n of c.getTracks())n.stop();throw t.reason}let o=new r.RTCPeerConnection,s=!1,u=()=>{if(!s){if(s=!0,m.close(),o.close(),f)for(let n of c.getTracks())n.stop();l.srcObject!==null&&(l.srcObject=null)}};o.addEventListener("track",n=>{l.srcObject=n.streams[0]??new MediaStream([n.track]),l.play?.()?.catch?.(()=>{})}),o.addEventListener("connectionstatechange",()=>e.onState?.(o.connectionState));for(let n of c.getAudioTracks())o.addTrack(n,c);let m=o.createDataChannel(ce);m.addEventListener("message",n=>{let d=ye(n.data);d!==void 0&&e.onError?.(d)});let p=()=>u();t?.addEventListener("abort",p,{once:!0});try{await o.setLocalDescription(await o.createOffer()),t?.throwIfAborted(),await de(o,e.iceTimeoutMs??1e4,t);let n=o.localDescription?.sdp;if(!n)throw new Error("connectVoice: the peer connection made no offer");let d=await e.start(n);if(t?.throwIfAborted(),typeof d?.id!="string"||d.id===""||typeof d.sdp!="string"||d.sdp==="")throw new TypeError("connectVoice: start answered no voice \u2014 it is { id, sdp }, chats.voice.start's answer as the backend got it");return await o.setRemoteDescription({type:"answer",sdp:d.sdp}),t?.removeEventListener("abort",p),{id:d.id,peer:o,audio:l,microphone:c,get muted(){return c.getAudioTracks().every(h=>!h.enabled)},mute(h){for(let w of c.getAudioTracks())w.enabled=!h},close:u}}catch(n){throw t?.removeEventListener("abort",p),u(),t?.aborted?t.reason:n}}function de(e,r,t){return e.iceGatheringState==="complete"?Promise.resolve():t?.aborted?Promise.reject(t.reason):new Promise((l,f)=>{let c=()=>{clearTimeout(u),e.removeEventListener("icegatheringstatechange",o),t?.removeEventListener("abort",s)},o=()=>{e.iceGatheringState==="complete"&&(c(),l())},s=()=>{c(),f(t?.reason)},u=setTimeout(()=>{c(),f(new Error(`connectVoice: the network candidates were not gathered in ${r} ms`))},r);e.addEventListener("icegatheringstatechange",o),t?.addEventListener("abort",s,{once:!0})})}function ye(e){if(typeof e=="string")try{let r=JSON.parse(e);return r.type!=="error"?void 0:typeof r.error?.message=="string"?r.error.message:typeof r.error?.code=="string"?r.error.code:"the voice failed"}catch{return}}function le(){let e=globalThis;if(typeof e.RTCPeerConnection!="function"||typeof e.navigator?.mediaDevices?.getUserMedia!="function")throw new TypeError("connectVoice: this runtime has no WebRTC (RTCPeerConnection, navigator.mediaDevices): a chat's voice is a browser's");let r=e.navigator.mediaDevices;return{RTCPeerConnection:e.RTCPeerConnection,getUserMedia:t=>r.getUserMedia(t)}}function ue(){let e=globalThis.document;if(!e)throw new TypeError("connectVoice: give audio \u2014 the element the voice plays in \u2014 where there is no document");let r=e.createElement("audio");return r.autoplay=!0,r}var i=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0;function fe(e,r,t){let l=i(i(i(e)?.components)?.schemas)??{},f=(p,n)=>{let d=new Set,h=(b,g,y)=>{let a=i(b);if(!a)return;if(typeof a.$ref=="string"){if(y.has(a.$ref)||!a.$ref.startsWith("#/components/schemas/"))return;h(l[a.$ref.slice(21)],g,new Set(y).add(a.$ref));return}if(a[S]===!0){d.add(g);return}for(let C of["anyOf","oneOf","allOf"]){let k=a[C];if(Array.isArray(k))for(let $ of k)h($,g,y)}let P=i(a.properties);if(P)for(let[C,k]of Object.entries(P))h(k,`${g}/${E(C)}`,y);i(a.items)&&h(a.items,`${g}/*`,y);for(let C of["additionalProperties","patternProperties","prefixItems"])if(a[C]!==void 0&&w(a[C],new Set(y)))throw new Error(`${t}: an encrypted field is a named property \u2014 not every key of a record, nor a tuple's place`)},w=(b,g)=>{if(Array.isArray(b))return b.some(a=>w(a,g));let y=i(b);return y?y[S]===!0?!0:typeof y.$ref=="string"&&!g.has(y.$ref)&&y.$ref.startsWith("#/components/schemas/")?(g.add(y.$ref),w(l[y.$ref.slice(21)],g)):Object.values(y).some(a=>typeof a=="object"&&a!==null&&w(a,g)):!1};return h(p,n,new Set),[...d]},c=p=>i(i(i(p)?.["application/json"])?.schema),o=[];o.push(...f(c(i(r.requestBody)?.content),"/body"));for(let p of Array.isArray(r.parameters)?r.parameters:[]){let n=i(p);if(!n)continue;let d=f(n.schema,`/query/${E(String(n.name))}`);if(d.length!==0){if(n.in!=="query")throw new Error(`${t}: ${String(n.in)} parameter ${String(n.name)} is marked encrypted \u2014 a body's or a query's field is`);if(d.some(h=>h.split("/").length!==3))throw new Error(`${t}: an encrypted query field is one of the query's own names`);o.push(...d)}}let s=i(r.responses)??{},u=Object.keys(s).filter(p=>/^2\d\d$/.test(p)).sort((p,n)=>p==="200"?-1:n==="200"?1:p.localeCompare(n)),m=u.length>0?f(c(i(s[u[0]])?.content),"/response"):[];if(o.length+m.length!==0){if(r["x-palbase-sse"]!==void 0&&m.length>0)throw new Error(`${t}: a streamed answer carries no encrypted field`);if(r["x-palbase-upload"]!==void 0)throw new Error(`${t}: an upload goes through storage, which seals nothing \u2014 it carries no encrypted field`);return{request:o,response:m}}}async function me(e){let r=`${e.method.toUpperCase()} ${e.path}`,t=i(i(i(i(e.contract)?.paths)?.[e.path])?.[e.method.toLowerCase()]),l=t?fe(e.contract,t,r):void 0;if(!l)return{body:e.body,query:e.query,open:async s=>s};let{key:f,header:c}=await R(e.key.kid,O(e.key.publicKey),x(e.projectId,e.method,e.path,e.params??[])),o=(s,u)=>s==null?s:v(s,u,l.request,(m,p)=>A(f,m,p));return{header:c,body:await o(e.body,"/body"),query:await o(e.query,"/query"),open:s=>s===void 0?Promise.resolve(s):v(s,"/response",l.response,async(u,m)=>{if(!V(m))throw new T("unopenable",`${r}: ${u} came plain where the contract says it is encrypted`);return M(f,u,m)})}}export{N as Analytics,_ as BackendError,G as Channel,U as Consent,ne as ConversationList,oe as ConversationView,re as DeletedGroupList,Z as Flags,z as GatewayError,J as InApp,F as Inbox,H as Installation,te as Messaging,W as Notify,L as PalbaseError,X as Purchases,D as RealtimeSocket,B as SESSION_START,ae as ScheduledList,I as SessionChangedError,se as ThreadView,K as WebPush,pe as connectVoice,ie as createClient,me as encryptedCall,ee as indexedDBKeyValue,Q as isBackendError,q as localStore,j as memoryStore,Y as redemptionToken};
1
+ /*! palbase 0.23.0 — Palbase SDK License (see LICENSE) */
2
+ import{a as I,b as j,c as q,d as G,e as D,f as H,g as N,h as U,i as F,j as B,k as J,l as K,m as W,n as X,o as Y,p as Z,q as ee,r as te,s as ne,t as re,u as oe,v as se,w as ae,x as ie}from"../chunks/5Q3GX7V7.js";import{a as _,b as Q,f as z}from"../chunks/YCVPM3S4.js";import"../chunks/BUZEU3KO.js";import"../chunks/QRRNK56K.js";import"../chunks/MQJN2IGB.js";import"../chunks/X2IT755X.js";import{b as S,c as T,d as O,f as x,g as R,j as A,k as V,l as M,m as E,o as v}from"../chunks/EPLCUBM7.js";import"../chunks/ASHJUFAR.js";import"../chunks/JEBQEIT2.js";import{b as L}from"../chunks/GRMAYURX.js";import"../chunks/CYQ5IWPO.js";import"../chunks/GUJW2U4D.js";var ce="oai-events";async function pe(e){if(typeof e?.start!="function")throw new TypeError("connectVoice: start(sdp) is the round trip to the app's backend, which starts the voice (chats.voice.start) and answers { id, sdp }");let r=e.rtc??le(),t=e.signal;t?.throwIfAborted();let l=e.audio??ue(),f=e.microphone===void 0,c=e.microphone??await r.getUserMedia({audio:!0});if(t?.aborted){if(f)for(let n of c.getTracks())n.stop();throw t.reason}let o=new r.RTCPeerConnection,s=!1,u=()=>{if(!s){if(s=!0,m.close(),o.close(),f)for(let n of c.getTracks())n.stop();l.srcObject!==null&&(l.srcObject=null)}};o.addEventListener("track",n=>{l.srcObject=n.streams[0]??new MediaStream([n.track]),l.play?.()?.catch?.(()=>{})}),o.addEventListener("connectionstatechange",()=>e.onState?.(o.connectionState));for(let n of c.getAudioTracks())o.addTrack(n,c);let m=o.createDataChannel(ce);m.addEventListener("message",n=>{let d=ye(n.data);d!==void 0&&e.onError?.(d)});let p=()=>u();t?.addEventListener("abort",p,{once:!0});try{await o.setLocalDescription(await o.createOffer()),t?.throwIfAborted(),await de(o,e.iceTimeoutMs??1e4,t);let n=o.localDescription?.sdp;if(!n)throw new Error("connectVoice: the peer connection made no offer");let d=await e.start(n);if(t?.throwIfAborted(),typeof d?.id!="string"||d.id===""||typeof d.sdp!="string"||d.sdp==="")throw new TypeError("connectVoice: start answered no voice \u2014 it is { id, sdp }, chats.voice.start's answer as the backend got it");return await o.setRemoteDescription({type:"answer",sdp:d.sdp}),t?.removeEventListener("abort",p),{id:d.id,peer:o,audio:l,microphone:c,get muted(){return c.getAudioTracks().every(h=>!h.enabled)},mute(h){for(let w of c.getAudioTracks())w.enabled=!h},close:u}}catch(n){throw t?.removeEventListener("abort",p),u(),t?.aborted?t.reason:n}}function de(e,r,t){return e.iceGatheringState==="complete"?Promise.resolve():t?.aborted?Promise.reject(t.reason):new Promise((l,f)=>{let c=()=>{clearTimeout(u),e.removeEventListener("icegatheringstatechange",o),t?.removeEventListener("abort",s)},o=()=>{e.iceGatheringState==="complete"&&(c(),l())},s=()=>{c(),f(t?.reason)},u=setTimeout(()=>{c(),f(new Error(`connectVoice: the network candidates were not gathered in ${r} ms`))},r);e.addEventListener("icegatheringstatechange",o),t?.addEventListener("abort",s,{once:!0})})}function ye(e){if(typeof e=="string")try{let r=JSON.parse(e);return r.type!=="error"?void 0:typeof r.error?.message=="string"?r.error.message:typeof r.error?.code=="string"?r.error.code:"the voice failed"}catch{return}}function le(){let e=globalThis;if(typeof e.RTCPeerConnection!="function"||typeof e.navigator?.mediaDevices?.getUserMedia!="function")throw new TypeError("connectVoice: this runtime has no WebRTC (RTCPeerConnection, navigator.mediaDevices): a chat's voice is a browser's");let r=e.navigator.mediaDevices;return{RTCPeerConnection:e.RTCPeerConnection,getUserMedia:t=>r.getUserMedia(t)}}function ue(){let e=globalThis.document;if(!e)throw new TypeError("connectVoice: give audio \u2014 the element the voice plays in \u2014 where there is no document");let r=e.createElement("audio");return r.autoplay=!0,r}var i=e=>typeof e=="object"&&e!==null&&!Array.isArray(e)?e:void 0;function fe(e,r,t){let l=i(i(i(e)?.components)?.schemas)??{},f=(p,n)=>{let d=new Set,h=(b,g,y)=>{let a=i(b);if(!a)return;if(typeof a.$ref=="string"){if(y.has(a.$ref)||!a.$ref.startsWith("#/components/schemas/"))return;h(l[a.$ref.slice(21)],g,new Set(y).add(a.$ref));return}if(a[S]===!0){d.add(g);return}for(let C of["anyOf","oneOf","allOf"]){let k=a[C];if(Array.isArray(k))for(let $ of k)h($,g,y)}let P=i(a.properties);if(P)for(let[C,k]of Object.entries(P))h(k,`${g}/${E(C)}`,y);i(a.items)&&h(a.items,`${g}/*`,y);for(let C of["additionalProperties","patternProperties","prefixItems"])if(a[C]!==void 0&&w(a[C],new Set(y)))throw new Error(`${t}: an encrypted field is a named property \u2014 not every key of a record, nor a tuple's place`)},w=(b,g)=>{if(Array.isArray(b))return b.some(a=>w(a,g));let y=i(b);return y?y[S]===!0?!0:typeof y.$ref=="string"&&!g.has(y.$ref)&&y.$ref.startsWith("#/components/schemas/")?(g.add(y.$ref),w(l[y.$ref.slice(21)],g)):Object.values(y).some(a=>typeof a=="object"&&a!==null&&w(a,g)):!1};return h(p,n,new Set),[...d]},c=p=>i(i(i(p)?.["application/json"])?.schema),o=[];o.push(...f(c(i(r.requestBody)?.content),"/body"));for(let p of Array.isArray(r.parameters)?r.parameters:[]){let n=i(p);if(!n)continue;let d=f(n.schema,`/query/${E(String(n.name))}`);if(d.length!==0){if(n.in!=="query")throw new Error(`${t}: ${String(n.in)} parameter ${String(n.name)} is marked encrypted \u2014 a body's or a query's field is`);if(d.some(h=>h.split("/").length!==3))throw new Error(`${t}: an encrypted query field is one of the query's own names`);o.push(...d)}}let s=i(r.responses)??{},u=Object.keys(s).filter(p=>/^2\d\d$/.test(p)).sort((p,n)=>p==="200"?-1:n==="200"?1:p.localeCompare(n)),m=u.length>0?f(c(i(s[u[0]])?.content),"/response"):[];if(o.length+m.length!==0){if(r["x-palbase-sse"]!==void 0&&m.length>0)throw new Error(`${t}: a streamed answer carries no encrypted field`);if(r["x-palbase-upload"]!==void 0)throw new Error(`${t}: an upload goes through storage, which seals nothing \u2014 it carries no encrypted field`);return{request:o,response:m}}}async function me(e){let r=`${e.method.toUpperCase()} ${e.path}`,t=i(i(i(i(e.contract)?.paths)?.[e.path])?.[e.method.toLowerCase()]),l=t?fe(e.contract,t,r):void 0;if(!l)return{body:e.body,query:e.query,open:async s=>s};let{key:f,header:c}=await R(e.key.kid,O(e.key.publicKey),x(e.projectId,e.method,e.path,e.params??[])),o=(s,u)=>s==null?s:v(s,u,l.request,(m,p)=>A(f,m,p));return{header:c,body:await o(e.body,"/body"),query:await o(e.query,"/query"),open:s=>s===void 0?Promise.resolve(s):v(s,"/response",l.response,async(u,m)=>{if(!V(m))throw new T("unopenable",`${r}: ${u} came plain where the contract says it is encrypted`);return M(f,u,m)})}}export{N as Analytics,_ as BackendError,G as Channel,U as Consent,ne as ConversationList,oe as ConversationView,re as DeletedGroupList,Z as Flags,z as GatewayError,J as InApp,F as Inbox,H as Installation,te as Messaging,W as Notify,L as PalbaseError,X as Purchases,D as RealtimeSocket,B as SESSION_START,ae as ScheduledList,I as SessionChangedError,se as ThreadView,K as WebPush,pe as connectVoice,ie as createClient,me as encryptedCall,ee as indexedDBKeyValue,Q as isBackendError,q as localStore,j as memoryStore,Y as redemptionToken};
@@ -1,2 +1,2 @@
1
- /*! palbase 0.21.0 — Palbase SDK License (see LICENSE) */
2
- import{a as i}from"../chunks/PI2NU4TV.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/7LCTRRHG.js";import"../chunks/5BNYK6GP.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.23.0 — Palbase SDK License (see LICENSE) */
2
+ import{a as i}from"../chunks/MQJN2IGB.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/X2IT755X.js";import"../chunks/GUJW2U4D.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.21.0 — Palbase SDK License (see LICENSE) */
2
- import{c as e,d as r,i as t}from"../chunks/SIIBIKCD.js";import"../chunks/UTZFJM2O.js";import"../chunks/Y3KNVE2U.js";import"../chunks/BQTZYHJN.js";import"../chunks/XZY2DTL7.js";import"../chunks/3MPGMDIO.js";import"../chunks/5BNYK6GP.js";export{e as RESERVED_CLIENT_NAMES,t as __registerBackend,r as isClientName};
1
+ /*! palbase 0.23.0 — Palbase SDK License (see LICENSE) */
2
+ import{c as e,d as r,i as t}from"../chunks/YCVPM3S4.js";import"../chunks/BUZEU3KO.js";import"../chunks/EPLCUBM7.js";import"../chunks/JEBQEIT2.js";import"../chunks/GRMAYURX.js";import"../chunks/CYQ5IWPO.js";import"../chunks/GUJW2U4D.js";export{e as RESERVED_CLIENT_NAMES,t as __registerBackend,r as isClientName};
@@ -1,2 +1,2 @@
1
- /*! palbase 0.21.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/PKYERPHS.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/7LCTRRHG.js";import"../chunks/XZY2DTL7.js";import"../chunks/3MPGMDIO.js";import"../chunks/5BNYK6GP.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.23.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/QRRNK56K.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/X2IT755X.js";import"../chunks/GRMAYURX.js";import"../chunks/CYQ5IWPO.js";import"../chunks/GUJW2U4D.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.21.0 — Palbase SDK License (see LICENSE) */
1
+ /*! palbase 0.23.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.21.0 — Palbase SDK License (see LICENSE) */
2
- import{x as f}from"../chunks/PJLACUYP.js";import"../chunks/SIIBIKCD.js";import"../chunks/UTZFJM2O.js";import"../chunks/PKYERPHS.js";import"../chunks/PI2NU4TV.js";import"../chunks/7LCTRRHG.js";import"../chunks/Y3KNVE2U.js";import"../chunks/LHLXKWXT.js";import"../chunks/BQTZYHJN.js";import"../chunks/XZY2DTL7.js";import"../chunks/3MPGMDIO.js";import"../chunks/5BNYK6GP.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.23.0 — Palbase SDK License (see LICENSE) */
2
+ import{x as f}from"../chunks/5Q3GX7V7.js";import"../chunks/YCVPM3S4.js";import"../chunks/BUZEU3KO.js";import"../chunks/QRRNK56K.js";import"../chunks/MQJN2IGB.js";import"../chunks/X2IT755X.js";import"../chunks/EPLCUBM7.js";import"../chunks/ASHJUFAR.js";import"../chunks/JEBQEIT2.js";import"../chunks/GRMAYURX.js";import"../chunks/CYQ5IWPO.js";import"../chunks/GUJW2U4D.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.21.0 — Palbase SDK License (see LICENSE) */
2
- import"../chunks/5BNYK6GP.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.23.0 — Palbase SDK License (see LICENSE) */
2
+ import"../chunks/GUJW2U4D.js";import{execFile as $}from"node:child_process";import{existsSync as y,mkdtempSync as k,readFileSync as S,rmSync as x,writeFileSync as P}from"node:fs";import{createRequire as O}from"node:module";import{tmpdir as W}from"node:os";import{dirname as g,join as o,relative as u,resolve as v,sep as d}from"node:path";var E=/\.(?:ts|js|mts|mjs)$/;function F(n){if(!/^[a-z][a-z0-9-]*$/.test(n.app))throw new TypeError(`palbase({ app }): ${JSON.stringify(n.app)} is an app's slug (palbase apps:list)`);let c=process.cwd(),p="",i="",f=()=>v(c,n.dir??"palbase"),m=()=>{let e=n.environments[p];if(!e)throw new Error(`palbase: the mode "${p}" is not built against any environment \u2014 say which in vite.config: palbase({ environments: { ${JSON.stringify(p)}: '<environment slug>' } })`);return e};return{name:"palbase",enforce:"pre",config(e,s){p=s.mode,i=s.command??"";let r=e.build?.rollupOptions?.onwarn;return{build:{rollupOptions:{onwarn(t,a){let l=String(t.exporter??t.id??"");if(t.code==="MISSING_EXPORT"&&l.includes(`${d}environments${d}`))throw new Error(`palbase: ${t.message} \u2014 ${m()}'s backend has no such route (palbase apps:sync brings what it has)`);r?r(t,a):a(t)}}}}},configResolved(e){c=e.root,p=e.mode,i=e.command??i},async buildStart(){i!=="build"||n.typecheck===!1||await j(c,m(),n.tsconfig)},resolveId(e,s){if(!s)return null;let r=f();if(e==="palbase"||e.startsWith("palbase/")){let w=u(r,s);return w.startsWith("..")||w===""?null:this.resolve(e,o(c,"index.html"),{skipSelf:!0})}if(!(e.startsWith(".")||e.startsWith("/")))return null;let t=v(g(s),e);if(E.test(t)||(t+=".ts"),g(t)!==r&&g(t)!==o(r,"palbe"))return null;let a=u(r,t),l=`${n.app}.ts`;if(a!==l&&!a.startsWith(`palbe${d}`))return null;let h=m(),b=o(r,"environments",h,a===l?l:o("palbe",a.slice(`palbe${d}`.length)));if(!y(b))throw new Error(`palbase: ${u(c,b)} is not there \u2014 palbase apps:sync writes it (is ${n.app} set in ${h}, and has ${h} that machine?)`);return b}}}async function j(n,c,p){let i=p?v(n,p):["tsconfig.app.json","tsconfig.json"].map(e=>o(n,e)).find(y);if(!i)return;if(!y(i))throw new Error(`palbase({ tsconfig }): ${u(n,i)} is not there`);let f;try{let e=O(o(n,"package.json")).resolve("typescript/package.json"),s=JSON.parse(S(e,"utf8")).bin?.tsc;if(!s)throw new Error("no tsc");f=o(g(e),s)}catch{throw new Error("palbase: the build type-checks the app against its environment with the app's TypeScript, and the app has none (npm i -D typescript) \u2014 or say palbase({ typecheck: false })")}let m=k(o(W(),"palbase-typecheck-"));try{let e=o(m,"tsconfig.json");P(e,JSON.stringify({extends:i,compilerOptions:{noEmit:!0,composite:!1,incremental:!1,moduleSuffixes:[`.${c}`,""]}}));let s=await new Promise(r=>$(process.execPath,[f,"-p",e,"--pretty","false"],{cwd:n,maxBuffer:16<<20},(t,a,l)=>r({code:t?typeof t.code=="number"?t.code:1:0,text:`${a}${l}`.trim()})));if(s.code!==0)throw new Error(`palbase: the app does not type-check against ${c}, the environment this build is made for \u2014 a route its backend does not have, or a call that does not fit it:
3
3
  ${s.text}`)}finally{x(m,{recursive:!0,force:!0})}}export{F as palbase};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "palbase",
3
- "version": "0.21.0",
3
+ "version": "0.23.0",
4
4
  "description": "Palbase for JavaScript: the web client (palbase/web), the server SDK (palbase/server), an organization's management SDK (palbase/cloud), the backend framework (palbase/backend), AI (palbase/ai) and the CLI (npx palbase).",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "homepage": "https://palbase.studio",
@@ -149,7 +149,7 @@
149
149
  "dependencies": {
150
150
  "@types/node": "26.6.4",
151
151
  "bun-types": "1.4.2",
152
- "palgres": "0.21.0",
152
+ "palgres": "0.23.0",
153
153
  "reflect-metadata": "^0.2.2",
154
154
  "typescript": "~6.0.3",
155
155
  "zod": "^4.6.5"
@@ -322,6 +322,21 @@ export interface TurnCost {
322
322
  final: boolean;
323
323
  /** The cost run by run so far — the turn's own and each subagent's, by its name and model: a turn at work is read as it spends. */
324
324
  runs: TurnRunCost[];
325
+ /** What the agent's advisor spent reading the turn: inside the totals above and its run's, said apart. Absent when it has none, or it spent nothing yet. */
326
+ advisor?: TurnAdvisorCost;
327
+ }
328
+ /** What a turn's advisor spent so far. */
329
+ export interface TurnAdvisorCost {
330
+ inputTokens: number;
331
+ outputTokens: number;
332
+ cacheReadTokens: number;
333
+ cacheWriteTokens: number;
334
+ /** In billionths of a US dollar. */
335
+ costNanoUsd: number;
336
+ /** costNanoUsd in dollars. */
337
+ usd: number;
338
+ /** Its model has no price: the cost is a lower bound. */
339
+ unpriced: boolean;
325
340
  }
326
341
  /** What one run of a turn — its own, or a subagent's — cost so far. */
327
342
  export interface TurnRunCost {
@@ -378,7 +393,11 @@ export interface TurnToolCall {
378
393
  }
379
394
  /** One part of a chat's stream as its channel carried it: what a page of the chat's past holds (chats.parts). */
380
395
  export interface ChatStreamPart {
381
- /** message, turn, text, reset, thinking, tool, agent, goal, voice, transcript, history — as the stream says them. */
396
+ /**
397
+ * message, turn, text, reset, thinking, tool, agent, advisor, goal, voice, transcript, history — as the stream says
398
+ * them. advisor: {response_id, run_id, seq, kind: step | final | ask, verdict: none | heads_up | answer | unreadable,
399
+ * rule?, message?, question?, told} — the agent's advisor read its work; told: the agent was told at its next step.
400
+ */
382
401
  type: string;
383
402
  /** The journal's sequence it was told at; absent for an answer's text, placed by its offset. */
384
403
  id?: number;
@@ -4,7 +4,7 @@ export { AISchemaError, prepare } from './schema.js';
4
4
  export { ToolError } from './tools.js';
5
5
  export type { Infer, StandardSchema } from './schema.js';
6
6
  export { partial } from './partial.js';
7
- export type { AISettings, Agent, AgentTool, AgentVersion, Agents, Chat, ChatEvents, ChatGoal, ChatMessage, ChatStreamPart, ChatToolCall, ChatVoice, Chats, CommitTrailer, CreateChat, Decision, Endpoint, EndpointInput, Endpoints, ForkChat, GoalChange, Goals, MemberInput, MessageAttachment, MessageFile, MessageImage, Repo, Repos, SendMessage, SetGoal, Settings, StartVoice, TurnArtifact, TurnCost, TurnRunCost, TurnToolCall, VoiceCommand, Voices, Workspaces, } from './chats.js';
8
- export type { AgentContext, AgentDefinitionInput, BackendAgent, BackendAgentOptions, BackendRepo, BackendTool, BackendToolOptions, ChatContext, ClientTool, ClientToolOptions, DeferredAnswer, Effort, HttpsToolRef, McpToolRef, PlatformToolName, PlatformToolRef, PreparedOutput, RepoTokenContext, RepoTokens, SubagentDefinition, Thinking, Tool, ToolAnswer, ToolContext, TurnDefinition, TurnMessage, } from './tools.js';
7
+ export type { AISettings, Agent, AgentTool, AgentVersion, Agents, Chat, ChatEvents, ChatGoal, ChatMessage, ChatStreamPart, ChatToolCall, ChatVoice, Chats, CommitTrailer, CreateChat, Decision, Endpoint, EndpointInput, Endpoints, ForkChat, GoalChange, Goals, MemberInput, MessageAttachment, MessageFile, MessageImage, Repo, Repos, SendMessage, SetGoal, Settings, StartVoice, TurnAdvisorCost, TurnArtifact, TurnCost, TurnRunCost, TurnToolCall, VoiceCommand, Voices, Workspaces, } from './chats.js';
8
+ export type { AdvisorDefinition, AgentContext, AgentDefinitionInput, BackendAgent, BackendAgentOptions, BackendRepo, BackendTool, BackendToolOptions, ChatContext, ClientTool, ClientToolOptions, DeferredAnswer, Effort, HttpsToolRef, McpToolRef, PlatformToolName, PlatformToolRef, PreparedOutput, RepoTokenContext, RepoTokens, SubagentDefinition, Thinking, Tool, ToolAnswer, ToolContext, TurnDefinition, TurnMessage, } from './tools.js';
9
9
  export type { AgentEvent, ChatEvent, GoalEvent, GoalKind, HistoryEvent, HistoryItem, MessageEvent, Publication, ResetEvent, TextEvent, ThinkingEvent, ToolEvent, ToolStatus, TranscriptEvent, TurnEnd, TurnEvent, TurnStatus, VoiceEvent, WaitingReason, } from '../../internal/src/chat.js';
10
10
  export type { ToolPart, ToolResult } from '../../internal/src/tool-output.js';
@@ -198,6 +198,24 @@ export interface SubagentDefinition {
198
198
  /** Left out: the agent's. Its reasoning is never in the chat's stream: only the turn's own is. */
199
199
  thinking?: Thinking;
200
200
  }
201
+ /**
202
+ * An agent's advisor: a second model that reads what the agent does after every step — its messages, the reasoning
203
+ * its model gives, its tool calls and what they answered — and, when a decision goes against the agent's
204
+ * instructions, its goal or the advisor's own rules, tells the agent so at its next step. The agent may ask it, and
205
+ * a turn's answer waits for its reading. It only reads: the agent's workspace, and the tools of the MCP servers named
206
+ * here that say they only read (readOnlyHint) — a turn whose advisor names one that does not say so is refused (400
207
+ * advisor_tool_not_read_only). Its calls are the turn's: in its cost (chats.turnCost(…).advisor) and its limit.
208
+ */
209
+ export interface AdvisorDefinition {
210
+ /** Left out: the agent's. */
211
+ model?: Model;
212
+ /** Its rules: what it watches the agent for (64 KiB at most). */
213
+ instructions?: string;
214
+ /** How hard its model thinks. Left out: the platform's. */
215
+ effort?: Effort;
216
+ /** MCP servers it reads with (32 at most); nothing it reads waits for a person. */
217
+ tools?: McpToolRef[];
218
+ }
201
219
  /** A schema already checked against what the provider holds a model to: ai.schema(name, zod). */
202
220
  export interface PreparedOutput {
203
221
  readonly name: string;
@@ -216,6 +234,8 @@ export interface AgentDefinitionInput {
216
234
  tools?: Tool[];
217
235
  /** 16 at most. */
218
236
  subagents?: SubagentDefinition[];
237
+ /** Reads the agent's work as it goes and tells it when it goes against its rules. None: no advisor. */
238
+ advisor?: AdvisorDefinition;
219
239
  /**
220
240
  * How many tool calls a turn makes at most (1–10 000, the engine's own bound): past it the agent is told it has no
221
241
  * tools left and answers. What a turn spends is its budget's to bound (chats.send({ budget })), not this.
@@ -1,5 +1,6 @@
1
1
  import type { PalbaseServer } from '../../server/src/index.js';
2
2
  export type AttestMode = 'off' | 'monitor' | 'enforce';
3
+ export declare const ATTEST_CHALLENGE_PATH = "/.well-known/palbase/attest-challenge";
3
4
  export declare const ATTEST_HEADERS: {
4
5
  readonly deviceId: 'x-palbase-device-id';
5
6
  readonly anchor: 'x-palbase-installation-anchor';
@@ -47,8 +48,23 @@ export declare class AttestGate {
47
48
  /** The mode in force: read again when 30 seconds old; the last one read while auth cannot answer. */
48
49
  modeNow(): Promise<AttestMode | undefined>;
49
50
  private readMode;
50
- /** One request to a route marked attest: true. `raw` is the body's bytes as they came. */
51
- check(request: Request, url: URL, raw: Uint8Array | undefined): Promise<AttestOutcome>;
51
+ /**
52
+ * One request to a route marked attest: true. `raw` is the body's bytes as they came; `target` the request-target as
53
+ * it came, which the client signed — the URL, parsed, would have re-encoded what WHATWG encodes (a ' in a query,
54
+ * a ^, a space).
55
+ */
56
+ check(request: Request, url: URL, raw: Uint8Array | undefined, target?: string): Promise<AttestOutcome>;
57
+ /**
58
+ * A challenge for the installation's anchor, ahead of its first proof (GET /.well-known/palbase/attest-challenge). Auth mints
59
+ * it as it does on every verdict: asked about a request with no evidence — nothing verified, nothing counted, no
60
+ * device's counter moved. None while the environment's mode is off; unavailable while it was never read, or auth
61
+ * cannot answer.
62
+ */
63
+ challengeFor(anchor: string): Promise<{
64
+ challenge?: string;
65
+ } | {
66
+ unavailable: true;
67
+ }>;
52
68
  private declared;
53
69
  private outcome;
54
70
  private schedule;
@@ -1,6 +1,6 @@
1
1
  import { type PalbaseServer } from '../../server/src/index.js';
2
2
  import { type AuthSpec, type RateLimit } from './decorators.js';
3
- import { type AppTokens, type CorsOptions } from './engine.js';
3
+ import { type AppTokens, type CorsOptions, type RequestInfo } from './engine.js';
4
4
  import { type DatabaseConfig } from './database.js';
5
5
  import { type PalbaseConnection } from './env.js';
6
6
  export interface AppConfig {
@@ -52,9 +52,7 @@ export interface PalbaseApplication {
52
52
  /** The port it serves on. */
53
53
  readonly port: number;
54
54
  /** One request, without the network — for tests. */
55
- handle(request: Request, info?: {
56
- remoteAddress?: string;
57
- }): Promise<Response>;
55
+ handle(request: Request, info?: RequestInfo): Promise<Response>;
58
56
  /** Stops taking connections, finishes the requests in flight (20 s at most), runs onShutdown(), sends the request traces still held (2 s at most). */
59
57
  close(): Promise<void>;
60
58
  }
@@ -126,14 +126,24 @@ export type AnswerOut = (text: string, done: () => void) => void;
126
126
  * position 131072"). One stream, in order: a log line is never cut by it.
127
127
  */
128
128
  export declare function said(mode: MigrateMode, result: unknown, out?: AnswerOut): Promise<void>;
129
+ /** A delivery's service transaction, as Database.$asService() gives it: a savepoint of it, its handle running SQL. */
130
+ export interface DeliveryService {
131
+ $attempt<T>(fn: (tx: {
132
+ query(sql: string, params?: unknown[]): Promise<unknown[]>;
133
+ }) => Promise<T>): Promise<T>;
134
+ }
129
135
  export interface OpenDatabase {
130
136
  model: Schema;
131
137
  binding: Binding;
132
138
  /** The engine: one transaction per request, as its caller (or the service role). */
133
139
  app: AppDatabase<Tables, Schemas>;
134
140
  requests: 'caller' | 'service';
135
- /** The platform's user.deleted: what the app kept of the user goes. */
136
- forget(userId: string): Promise<{
141
+ /**
142
+ * The platform's user.deleted: what the app kept of the user goes — in the delivery's service transaction (its
143
+ * Database.$asService()), so with every other handler's work of the delivery or with none of it, and within the
144
+ * request's share of connections.
145
+ */
146
+ forget(userId: string, service: DeliveryService): Promise<{
137
147
  deleted: number;
138
148
  detached: number;
139
149
  }>;