@protobase/client 0.2.0 → 0.3.1

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.
@@ -21,8 +21,8 @@ export type AssistantConnection = {
21
21
  export type AssistantClient = {
22
22
  /** Follows the event stream, reconnecting until the returned function is called; every connection starts with a `state` event. */
23
23
  connect: (onEvent: (event: AssistantEvent) => void, onConnection?: (connection: AssistantConnection) => void) => () => void;
24
- /** Sends a message; the reply arrives as events. Rejects with `ApiError`. */
25
- send: (text: string) => Promise<void>;
24
+ /** Sends a message, with the page the user is on when given; the reply arrives as events. Rejects with `ApiError`. */
25
+ send: (text: string, page?: string) => Promise<void>;
26
26
  /** Sends a click on a card's button; the backend answers with events. Rejects with `ApiError`. */
27
27
  act: (partId: string, actionId: string) => Promise<void>;
28
28
  };
package/dist/assistant.js CHANGED
@@ -59,10 +59,13 @@ const createAssistantClient = (options) => {
59
59
  })();
60
60
  return () => controller.abort();
61
61
  },
62
- send: async (text) => {
62
+ send: async (text, page) => {
63
63
  await request("/messages", {
64
64
  method: "POST",
65
- body: { text }
65
+ body: {
66
+ text,
67
+ ...page && { page }
68
+ }
66
69
  });
67
70
  },
68
71
  act: async (partId, actionId) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@protobase/client",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "Typed fetch client for the Protobase REST API.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -26,8 +26,8 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "better-auth": "^1.7.7",
29
- "@protobase/layout": "0.2.0",
30
- "@protobase/schema": "0.2.0"
29
+ "@protobase/layout": "0.3.1",
30
+ "@protobase/schema": "0.3.1"
31
31
  },
32
32
  "scripts": {
33
33
  "build": "tsdown"