@adaptive-ai/sdk 0.1.16 → 0.1.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/index.d.ts +146 -26
- package/dist/server/index.js +2 -2
- package/package.json +1 -1
package/dist/server/index.d.ts
CHANGED
|
@@ -1609,35 +1609,54 @@ declare const coerce: {
|
|
|
1609
1609
|
date: (typeof ZodDate)["create"];
|
|
1610
1610
|
};
|
|
1611
1611
|
declare const NEVER: never;
|
|
1612
|
-
declare const
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1612
|
+
export declare const appConfigSchema: z.ZodObject<{
|
|
1613
|
+
crons: z.ZodArray<z.ZodObject<{
|
|
1614
|
+
slug: z.ZodString;
|
|
1615
|
+
schedule: z.ZodString;
|
|
1616
|
+
rpcEndpoint: z.ZodString;
|
|
1617
|
+
isEnabled: z.ZodDefault<z.ZodBoolean>;
|
|
1618
|
+
stopAt: z.ZodOptional<z.ZodString>;
|
|
1619
|
+
maxExecutions: z.ZodOptional<z.ZodNumber>;
|
|
1620
|
+
timezone: z.ZodOptional<z.ZodString>;
|
|
1621
|
+
}, "strip", z.ZodTypeAny, {
|
|
1622
|
+
slug: string;
|
|
1623
|
+
schedule: string;
|
|
1624
|
+
rpcEndpoint: string;
|
|
1625
|
+
isEnabled: boolean;
|
|
1626
|
+
stopAt?: string | undefined;
|
|
1627
|
+
maxExecutions?: number | undefined;
|
|
1628
|
+
timezone?: string | undefined;
|
|
1629
|
+
}, {
|
|
1630
|
+
slug: string;
|
|
1631
|
+
schedule: string;
|
|
1632
|
+
rpcEndpoint: string;
|
|
1633
|
+
isEnabled?: boolean | undefined;
|
|
1634
|
+
stopAt?: string | undefined;
|
|
1635
|
+
maxExecutions?: number | undefined;
|
|
1636
|
+
timezone?: string | undefined;
|
|
1637
|
+
}>, "many">;
|
|
1620
1638
|
}, "strip", z.ZodTypeAny, {
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1639
|
+
crons: {
|
|
1640
|
+
slug: string;
|
|
1641
|
+
schedule: string;
|
|
1642
|
+
rpcEndpoint: string;
|
|
1643
|
+
isEnabled: boolean;
|
|
1644
|
+
stopAt?: string | undefined;
|
|
1645
|
+
maxExecutions?: number | undefined;
|
|
1646
|
+
timezone?: string | undefined;
|
|
1647
|
+
}[];
|
|
1628
1648
|
}, {
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1635
|
-
|
|
1649
|
+
crons: {
|
|
1650
|
+
slug: string;
|
|
1651
|
+
schedule: string;
|
|
1652
|
+
rpcEndpoint: string;
|
|
1653
|
+
isEnabled?: boolean | undefined;
|
|
1654
|
+
stopAt?: string | undefined;
|
|
1655
|
+
maxExecutions?: number | undefined;
|
|
1656
|
+
timezone?: string | undefined;
|
|
1657
|
+
}[];
|
|
1636
1658
|
}>;
|
|
1637
|
-
export type
|
|
1638
|
-
export type AppConfig = {
|
|
1639
|
-
crons: BoxmanCron[];
|
|
1640
|
-
};
|
|
1659
|
+
export type AppConfig = z.infer<typeof appConfigSchema>;
|
|
1641
1660
|
declare const AuthProvider: {
|
|
1642
1661
|
readonly AC1: "AC1";
|
|
1643
1662
|
readonly GITHUB_USER: "GITHUB_USER";
|
|
@@ -3082,12 +3101,16 @@ declare let client: {
|
|
|
3082
3101
|
orientation?: "portrait" | "landscape" | undefined;
|
|
3083
3102
|
scrollToPage?: number | undefined;
|
|
3084
3103
|
returnPageText?: boolean | undefined;
|
|
3104
|
+
environment?: "development" | "production" | undefined;
|
|
3105
|
+
onBehalfOfCurrentUser?: boolean | undefined;
|
|
3085
3106
|
};
|
|
3086
3107
|
_input_out: {
|
|
3087
3108
|
url: string;
|
|
3088
3109
|
showClickTargets: boolean;
|
|
3089
3110
|
orientation: "portrait" | "landscape";
|
|
3090
3111
|
returnPageText: boolean;
|
|
3112
|
+
environment: "development" | "production";
|
|
3113
|
+
onBehalfOfCurrentUser: boolean;
|
|
3091
3114
|
clickOnTargetIndex?: number | undefined;
|
|
3092
3115
|
scrollToPage?: number | undefined;
|
|
3093
3116
|
};
|
|
@@ -3557,6 +3580,103 @@ declare let client: {
|
|
|
3557
3580
|
body?: undefined;
|
|
3558
3581
|
}>>;
|
|
3559
3582
|
};
|
|
3583
|
+
sendPushNotification: {
|
|
3584
|
+
mutate: _trpc_client.Resolver<_trpc_server.BuildProcedure<"mutation", {
|
|
3585
|
+
_config: _trpc_server.RootConfig<{
|
|
3586
|
+
ctx: {
|
|
3587
|
+
appId: string;
|
|
3588
|
+
versionId: string;
|
|
3589
|
+
appName: string;
|
|
3590
|
+
appSubdomain: string;
|
|
3591
|
+
userId: string;
|
|
3592
|
+
isTesting: boolean;
|
|
3593
|
+
rpcMethod: string;
|
|
3594
|
+
requestId: string;
|
|
3595
|
+
type?: undefined;
|
|
3596
|
+
dbUrl?: string | null | undefined;
|
|
3597
|
+
userIdActual?: string | null | undefined;
|
|
3598
|
+
channelId?: string | null | undefined;
|
|
3599
|
+
} | {
|
|
3600
|
+
type: "BOXMAN_REQUEST";
|
|
3601
|
+
boxId: string;
|
|
3602
|
+
isDevelopment: boolean | null;
|
|
3603
|
+
appId?: string | null | undefined;
|
|
3604
|
+
rpcMethod?: string | null | undefined;
|
|
3605
|
+
requestId?: string | null | undefined;
|
|
3606
|
+
channelId?: string | null | undefined;
|
|
3607
|
+
platformUserId?: string | null | undefined;
|
|
3608
|
+
agent?: string | null | undefined;
|
|
3609
|
+
sessionId?: string | null | undefined;
|
|
3610
|
+
pushToken?: string | null | undefined;
|
|
3611
|
+
};
|
|
3612
|
+
meta: object;
|
|
3613
|
+
errorShape: {
|
|
3614
|
+
data: {
|
|
3615
|
+
zodError: typeToFlattenedError<any, string> | null;
|
|
3616
|
+
code: _trpc_server_rpc.TRPC_ERROR_CODE_KEY;
|
|
3617
|
+
httpStatus: number;
|
|
3618
|
+
path?: string;
|
|
3619
|
+
stack?: string;
|
|
3620
|
+
};
|
|
3621
|
+
message: string;
|
|
3622
|
+
code: _trpc_server_rpc.TRPC_ERROR_CODE_NUMBER;
|
|
3623
|
+
};
|
|
3624
|
+
transformer: typeof superjson;
|
|
3625
|
+
}>;
|
|
3626
|
+
_meta: object;
|
|
3627
|
+
_ctx_out: {
|
|
3628
|
+
type: undefined;
|
|
3629
|
+
appId: string;
|
|
3630
|
+
versionId: string;
|
|
3631
|
+
dbUrl: string | null | undefined;
|
|
3632
|
+
appName: string;
|
|
3633
|
+
appSubdomain: string;
|
|
3634
|
+
userId: string;
|
|
3635
|
+
userIdActual: string | null | undefined;
|
|
3636
|
+
isTesting: boolean;
|
|
3637
|
+
rpcMethod: string;
|
|
3638
|
+
requestId: string;
|
|
3639
|
+
channelId: string | null | undefined;
|
|
3640
|
+
} | {
|
|
3641
|
+
type: "BOXMAN_REQUEST";
|
|
3642
|
+
appId: string | null | undefined;
|
|
3643
|
+
boxId: string;
|
|
3644
|
+
rpcMethod: string | null | undefined;
|
|
3645
|
+
requestId: string | null | undefined;
|
|
3646
|
+
channelId: string | null | undefined;
|
|
3647
|
+
platformUserId: string | null | undefined;
|
|
3648
|
+
isDevelopment: boolean | null;
|
|
3649
|
+
agent: string | null | undefined;
|
|
3650
|
+
sessionId: string | null | undefined;
|
|
3651
|
+
pushToken: string | null | undefined;
|
|
3652
|
+
};
|
|
3653
|
+
_input_in: {
|
|
3654
|
+
body: string;
|
|
3655
|
+
title: string;
|
|
3656
|
+
data?: {
|
|
3657
|
+
appId?: string | undefined;
|
|
3658
|
+
} | undefined;
|
|
3659
|
+
subtitle?: string | undefined;
|
|
3660
|
+
sound?: string | undefined;
|
|
3661
|
+
badge?: number | undefined;
|
|
3662
|
+
};
|
|
3663
|
+
_input_out: {
|
|
3664
|
+
body: string;
|
|
3665
|
+
title: string;
|
|
3666
|
+
data?: {
|
|
3667
|
+
appId?: string | undefined;
|
|
3668
|
+
} | undefined;
|
|
3669
|
+
subtitle?: string | undefined;
|
|
3670
|
+
sound?: string | undefined;
|
|
3671
|
+
badge?: number | undefined;
|
|
3672
|
+
};
|
|
3673
|
+
_output_in: typeof _trpc_server.unsetMarker;
|
|
3674
|
+
_output_out: typeof _trpc_server.unsetMarker;
|
|
3675
|
+
}, {
|
|
3676
|
+
ok: true;
|
|
3677
|
+
ticketCount: number;
|
|
3678
|
+
}>>;
|
|
3679
|
+
};
|
|
3560
3680
|
health: {
|
|
3561
3681
|
query: _trpc_client.Resolver<_trpc_server.BuildProcedure<"query", {
|
|
3562
3682
|
_config: _trpc_server.RootConfig<{
|
package/dist/server/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {createTRPCProxyClient,httpLink}from'@trpc/client';import {AsyncLocalStorage}from'async_hooks';import
|
|
2
|
-
export{
|
|
1
|
+
import {z as z$1}from'zod';import {createTRPCProxyClient,httpLink}from'@trpc/client';import {AsyncLocalStorage}from'async_hooks';import _ from'superjson';var W=z$1.object({slug:z$1.string(),schedule:z$1.string(),rpcEndpoint:z$1.string(),isEnabled:z$1.boolean().default(true),stopAt:z$1.string().datetime().optional(),maxExecutions:z$1.number().optional(),timezone:z$1.string().optional()}),J=z$1.object({crons:z$1.array(W)});function v(e){let r=Object.create(null);for(let t in e){let n=e[t];r[n]=t;}return r}var h={PARSE_ERROR:-32700,BAD_REQUEST:-32600,INTERNAL_SERVER_ERROR:-32603,NOT_IMPLEMENTED:-32603,UNAUTHORIZED:-32001,FORBIDDEN:-32003,NOT_FOUND:-32004,METHOD_NOT_SUPPORTED:-32005,TIMEOUT:-32008,CONFLICT:-32009,PRECONDITION_FAILED:-32012,PAYLOAD_TOO_LARGE:-32013,UNPROCESSABLE_CONTENT:-32022,TOO_MANY_REQUESTS:-32029,CLIENT_CLOSED_REQUEST:-32099};v(h);v(h);typeof window>"u"||"Deno"in window||globalThis.process?.env?.NODE_ENV==="test"||!!globalThis.process?.env?.JEST_WORKER_ID||!!globalThis.process?.env?.VITEST_WORKER_ID;var g=class e extends Error{static prefix="__MISSING AUTH FOR SCOPE";static jsonRpcCode=-32001;constructor({provider:r,scope:t,accountId:n,popup:o=false}){let s=btoa(JSON.stringify({provider:r,scope:t,accountId:n}));super(`${e.prefix}: ${s}${o?" --popup":" end"}`);}jsonRpcError(){return {code:e.jsonRpcCode,message:this.message}}static check(r){return r?.message?.startsWith(e.prefix)}};var G=createTRPCProxyClient({transformer:_,links:[]});function ze({baseUrl:e,realtimeDomain:r,guestServicesUrl:t}){globalThis.env||(globalThis.env={},globalThis.env.BASE_URL=e,globalThis.env.REALTIME_DOMAIN=r,globalThis.env.GUEST_SERVICES_URL=t,G=createTRPCProxyClient({transformer:_,links:[httpLink({url:t,transformer:_,headers:()=>{let n=A();if(!n)throw new Error("Missing request context");return {"x-request-id":n.requestId}}})]}),console.log("Adaptive SDK server environment initialized"));}var Q=new AsyncLocalStorage,me=new Proxy({},{get(e,r){return async t=>{if(globalThis.env===void 0)throw new Error("Adaptive SDK server environment is not initialized. Please call initializeServerEnvironment first.");let o=G[r];if(!o||typeof o.mutate!="function")throw new Error(`Property "${String(r)}" is not a mutation procedure`);return o.mutate(t)}}});function A(){return Q.getStore()}function Ke(e){let r=A();r&&Object.assign(r,e);}async function He(e,r){return Q.run(e,r)}function Ge(){return globalThis.env.BASE_URL}var N=null;function Qe(){return N}function We({channelId:e,onUpdate:r}){let t=new WebSocket(`wss://${globalThis.env.REALTIME_DOMAIN}/${e}`),n=-1;function o(s){r&&(N=Date.now());try{let i=JSON.parse(s.data.toString());if(i?.id&&i.id>n){let d=_.parse(i.payload);r?.(d),n=i.id;}}catch{}}return t.addEventListener("message",o),{destroy(){t.close(),t.removeEventListener("message",o);}}}async function z({channelId:e,data:r}){N=Date.now(),await fetch(`https://${globalThis.env.REALTIME_DOMAIN}/${e}`,{method:"POST",body:_.stringify(r)}).catch(console.error);}async function Je(){let e,r=A()?.channelId;if(!r)throw new Error("API's using `startRealtimeResponse` must be called via `useRealtimeMutation`.");return {next(t){e=t,z({channelId:r,data:t});},end(){return z({channelId:r,data:e}),e}}}function K(e){throw new g({provider:"AC1",popup:true})}async function Ze(e){let r=await me.getCurrentUser();if(r?.error==="SEED")throw new Error('Call to "getAuth" in seed function is not allowed. Seed functions should not depend on user data.');if(r.userId)return {userId:r.userId,status:"authenticated",signIn:K,providers:r.providers};if(e?.required)throw new g({provider:"AC1"});return {userId:null,status:"unauthenticated",signIn:K,providers:[]}}
|
|
2
|
+
export{J as appConfigSchema,Ze as getAuth,Ge as getBaseUrl,Qe as getLastStreamTime,We as getRealtimeStore,A as getRequestContext,ze as initializeServerEnvironment,me as mcp,He as runWithContext,z as setRealtimeStore,Ke as setRequestContext,Je as startRealtimeResponse};
|