@puckeditor/cloud-client 0.1.0-canary.f87c29b6 → 0.1.0-canary.ff322ae0

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/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import z from 'zod/v4';
2
1
  import { UIMessage } from 'ai';
2
+ import z from 'zod/v4';
3
3
  import { Config, Data } from '@measured/puck';
4
4
 
5
5
  type UserTool<INPUT extends z.ZodTypeAny = z.ZodTypeAny, OUTPUT extends z.ZodTypeAny = z.ZodTypeAny> = {
@@ -10,27 +10,24 @@ type UserTool<INPUT extends z.ZodTypeAny = z.ZodTypeAny, OUTPUT extends z.ZodTyp
10
10
  execute: (input: z.infer<INPUT>) => Promise<z.infer<OUTPUT>> | z.infer<OUTPUT>;
11
11
  };
12
12
  declare const tool: <INPUT extends z.ZodTypeAny, OUTPUT extends z.ZodTypeAny>(t: UserTool<INPUT, OUTPUT>) => UserTool<INPUT, OUTPUT>;
13
-
13
+ type UserToolRegistry = Record<string, UserTool>;
14
+ declare const endpoints: readonly ["chat"];
15
+ type Endpoint = (typeof endpoints)[number];
16
+ type PuckCatchAll = [Endpoint | string, ...string[]];
14
17
  type ChatParams = {
18
+ context?: string;
15
19
  chatId?: string;
16
20
  messages: UIMessage[];
17
21
  config: Config;
18
22
  pageData: Data;
19
- };
20
- declare function chat({ chatId, messages: initialMessages, config, pageData }: ChatParams, { ai, apiKey, host, }: PuckCloudOptions): Response;
21
-
22
- declare function puckHandler(request: Request, options: PuckCloudOptions): Promise<Response>;
23
-
24
- declare const endpoints: readonly ["chat"];
25
- type Endpoint = (typeof endpoints)[number];
26
- type PuckCloudOptions = {
27
- ai?: {
28
- context?: string;
29
- tools?: UserToolRegistry;
30
- };
23
+ tools?: UserToolRegistry;
31
24
  host?: string;
32
25
  apiKey?: string;
33
26
  };
34
- type UserToolRegistry = Record<string, UserTool>;
27
+ type ApiParams = {
28
+ chat: ChatParams;
29
+ };
30
+ declare function chat({ chatId, context, messages: initialMessages, config, pageData, tools, apiKey, host, }: ApiParams["chat"]): Response;
31
+ declare function all<ThisEndpoint extends Endpoint | string>(path: [ThisEndpoint | string, ...string[]] | string[] | string, body: ThisEndpoint extends Endpoint ? ApiParams[ThisEndpoint] : any): Promise<Response>;
35
32
 
36
- export { type ChatParams, type Endpoint, type PuckCloudOptions, type UserTool, type UserToolRegistry, chat, endpoints, puckHandler, tool };
33
+ export { type ApiParams, type ChatParams, type Endpoint, type PuckCatchAll, all, chat, tool };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import z from 'zod/v4';
2
1
  import { UIMessage } from 'ai';
2
+ import z from 'zod/v4';
3
3
  import { Config, Data } from '@measured/puck';
4
4
 
5
5
  type UserTool<INPUT extends z.ZodTypeAny = z.ZodTypeAny, OUTPUT extends z.ZodTypeAny = z.ZodTypeAny> = {
@@ -10,27 +10,24 @@ type UserTool<INPUT extends z.ZodTypeAny = z.ZodTypeAny, OUTPUT extends z.ZodTyp
10
10
  execute: (input: z.infer<INPUT>) => Promise<z.infer<OUTPUT>> | z.infer<OUTPUT>;
11
11
  };
12
12
  declare const tool: <INPUT extends z.ZodTypeAny, OUTPUT extends z.ZodTypeAny>(t: UserTool<INPUT, OUTPUT>) => UserTool<INPUT, OUTPUT>;
13
-
13
+ type UserToolRegistry = Record<string, UserTool>;
14
+ declare const endpoints: readonly ["chat"];
15
+ type Endpoint = (typeof endpoints)[number];
16
+ type PuckCatchAll = [Endpoint | string, ...string[]];
14
17
  type ChatParams = {
18
+ context?: string;
15
19
  chatId?: string;
16
20
  messages: UIMessage[];
17
21
  config: Config;
18
22
  pageData: Data;
19
- };
20
- declare function chat({ chatId, messages: initialMessages, config, pageData }: ChatParams, { ai, apiKey, host, }: PuckCloudOptions): Response;
21
-
22
- declare function puckHandler(request: Request, options: PuckCloudOptions): Promise<Response>;
23
-
24
- declare const endpoints: readonly ["chat"];
25
- type Endpoint = (typeof endpoints)[number];
26
- type PuckCloudOptions = {
27
- ai?: {
28
- context?: string;
29
- tools?: UserToolRegistry;
30
- };
23
+ tools?: UserToolRegistry;
31
24
  host?: string;
32
25
  apiKey?: string;
33
26
  };
34
- type UserToolRegistry = Record<string, UserTool>;
27
+ type ApiParams = {
28
+ chat: ChatParams;
29
+ };
30
+ declare function chat({ chatId, context, messages: initialMessages, config, pageData, tools, apiKey, host, }: ApiParams["chat"]): Response;
31
+ declare function all<ThisEndpoint extends Endpoint | string>(path: [ThisEndpoint | string, ...string[]] | string[] | string, body: ThisEndpoint extends Endpoint ? ApiParams[ThisEndpoint] : any): Promise<Response>;
35
32
 
36
- export { type ChatParams, type Endpoint, type PuckCloudOptions, type UserTool, type UserToolRegistry, chat, endpoints, puckHandler, tool };
33
+ export { type ApiParams, type ChatParams, type Endpoint, type PuckCatchAll, all, chat, tool };