@puckeditor/cloud-client 0.1.0-canary.ff322ae0 → 0.1.0-canary.ffa73f47
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 +21 -13
- package/dist/index.d.ts +21 -13
- package/dist/index.js +162 -19697
- package/dist/index.mjs +151 -19687
- package/package.json +6 -4
package/dist/index.d.mts
CHANGED
|
@@ -2,6 +2,10 @@ import { UIMessage } from 'ai';
|
|
|
2
2
|
import z from 'zod/v4';
|
|
3
3
|
import { Config, Data } from '@measured/puck';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Generator function that streams the response body from a fetch request.
|
|
7
|
+
*/
|
|
8
|
+
declare function streamingFetch(input: RequestInfo | URL, init?: RequestInit): AsyncGenerator<string, void, unknown>;
|
|
5
9
|
type UserTool<INPUT extends z.ZodTypeAny = z.ZodTypeAny, OUTPUT extends z.ZodTypeAny = z.ZodTypeAny> = {
|
|
6
10
|
name?: string;
|
|
7
11
|
description: string;
|
|
@@ -14,20 +18,24 @@ type UserToolRegistry = Record<string, UserTool>;
|
|
|
14
18
|
declare const endpoints: readonly ["chat"];
|
|
15
19
|
type Endpoint = (typeof endpoints)[number];
|
|
16
20
|
type PuckCatchAll = [Endpoint | string, ...string[]];
|
|
17
|
-
type
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
type ApiParams = {
|
|
22
|
+
chat: {
|
|
23
|
+
context?: string;
|
|
24
|
+
chatId?: string;
|
|
25
|
+
messages: UIMessage[];
|
|
26
|
+
config: Config;
|
|
27
|
+
pageData: Data;
|
|
28
|
+
tools?: UserToolRegistry;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
declare const createPuckApi: ({ apiKey, host, }?: {
|
|
24
32
|
host?: string;
|
|
25
33
|
apiKey?: string;
|
|
34
|
+
}) => {
|
|
35
|
+
all: <ThisEndpoint extends Endpoint | string>(path: [ThisEndpoint | string, ...string[]], body: ThisEndpoint extends Endpoint ? ApiParams[ThisEndpoint] : any) => Promise<Response>;
|
|
36
|
+
ai: {
|
|
37
|
+
chat: ({ chatId, context, messages: initialMessages, config, pageData, tools, }: ApiParams["chat"]) => Promise<Response>;
|
|
38
|
+
};
|
|
26
39
|
};
|
|
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>;
|
|
32
40
|
|
|
33
|
-
export { type ApiParams, type
|
|
41
|
+
export { type ApiParams, type Endpoint, type PuckCatchAll, createPuckApi, streamingFetch, tool };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,10 @@ import { UIMessage } from 'ai';
|
|
|
2
2
|
import z from 'zod/v4';
|
|
3
3
|
import { Config, Data } from '@measured/puck';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* Generator function that streams the response body from a fetch request.
|
|
7
|
+
*/
|
|
8
|
+
declare function streamingFetch(input: RequestInfo | URL, init?: RequestInit): AsyncGenerator<string, void, unknown>;
|
|
5
9
|
type UserTool<INPUT extends z.ZodTypeAny = z.ZodTypeAny, OUTPUT extends z.ZodTypeAny = z.ZodTypeAny> = {
|
|
6
10
|
name?: string;
|
|
7
11
|
description: string;
|
|
@@ -14,20 +18,24 @@ type UserToolRegistry = Record<string, UserTool>;
|
|
|
14
18
|
declare const endpoints: readonly ["chat"];
|
|
15
19
|
type Endpoint = (typeof endpoints)[number];
|
|
16
20
|
type PuckCatchAll = [Endpoint | string, ...string[]];
|
|
17
|
-
type
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
type ApiParams = {
|
|
22
|
+
chat: {
|
|
23
|
+
context?: string;
|
|
24
|
+
chatId?: string;
|
|
25
|
+
messages: UIMessage[];
|
|
26
|
+
config: Config;
|
|
27
|
+
pageData: Data;
|
|
28
|
+
tools?: UserToolRegistry;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
declare const createPuckApi: ({ apiKey, host, }?: {
|
|
24
32
|
host?: string;
|
|
25
33
|
apiKey?: string;
|
|
34
|
+
}) => {
|
|
35
|
+
all: <ThisEndpoint extends Endpoint | string>(path: [ThisEndpoint | string, ...string[]], body: ThisEndpoint extends Endpoint ? ApiParams[ThisEndpoint] : any) => Promise<Response>;
|
|
36
|
+
ai: {
|
|
37
|
+
chat: ({ chatId, context, messages: initialMessages, config, pageData, tools, }: ApiParams["chat"]) => Promise<Response>;
|
|
38
|
+
};
|
|
26
39
|
};
|
|
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>;
|
|
32
40
|
|
|
33
|
-
export { type ApiParams, type
|
|
41
|
+
export { type ApiParams, type Endpoint, type PuckCatchAll, createPuckApi, streamingFetch, tool };
|