@letta-ai/letta-react 0.2.0 → 0.2.2
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/README.md +5 -48
- package/dist/index.d.ts +0 -1
- package/dist/index.js +13 -19
- package/dist/index.js.map +3 -3
- package/dist/useLettaQuery/useLettaQuery.d.ts +6 -6
- package/index.d.ts +0 -1
- package/index.js +13 -19
- package/index.js.map +3 -3
- package/package.json +1 -1
- package/src/index.ts +0 -1
- package/src/useLettaQuery/useLettaQuery.test.tsx +9 -6
- package/src/useLettaQuery/useLettaQuery.ts +21 -28
- package/useLettaQuery/useLettaQuery.d.ts +6 -6
- package/dist/useLetta/useLetta.d.ts +0 -2
- package/src/useLetta/useLetta.ts +0 -8
- package/useLetta/useLetta.d.ts +0 -2
@@ -1,6 +1,6 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
1
|
+
import { LettaClient } from '@letta-ai/letta-client';
|
2
|
+
import type { UseQueryOptions } from '@tanstack/react-query/src/types.ts';
|
3
|
+
type Query<Res> = (client: LettaClient) => Res;
|
4
|
+
type Options<Res> = Omit<UseQueryOptions<Res>, 'queryFn'>;
|
5
|
+
export declare function useLettaQuery<Res>(operation: Query<Promise<Res>>, queryOptions: Options<Res>): import("@tanstack/react-query").UseQueryResult<Res, Error>;
|
6
|
+
export {};
|
package/index.d.ts
CHANGED
package/index.js
CHANGED
@@ -48254,30 +48254,24 @@ var require_letta_client = __commonJS({
|
|
48254
48254
|
});
|
48255
48255
|
|
48256
48256
|
// src/useLettaQuery/useLettaQuery.ts
|
48257
|
+
var import_letta_client = __toESM(require_letta_client());
|
48257
48258
|
import { useQuery } from "@tanstack/react-query";
|
48258
|
-
|
48259
|
-
|
48260
|
-
|
48261
|
-
|
48259
|
+
import { useRef } from "react";
|
48260
|
+
function useLettaQuery(operation, queryOptions) {
|
48261
|
+
const client = useRef(
|
48262
|
+
new import_letta_client.LettaClient({
|
48263
|
+
// force to use the default base URL, you should by proxy it in your server
|
48264
|
+
baseUrl: "/"
|
48265
|
+
})
|
48266
|
+
);
|
48262
48267
|
return useQuery({
|
48263
|
-
|
48264
|
-
queryFn: () => {
|
48265
|
-
return operation(
|
48266
|
-
}
|
48267
|
-
...queryOptions || {}
|
48268
|
+
...queryOptions,
|
48269
|
+
queryFn: async () => {
|
48270
|
+
return operation(client.current);
|
48271
|
+
}
|
48268
48272
|
});
|
48269
48273
|
}
|
48270
|
-
|
48271
|
-
// src/useLetta/useLetta.ts
|
48272
|
-
var import_letta_client = __toESM(require_letta_client());
|
48273
|
-
import { useState } from "react";
|
48274
|
-
function useLetta(options = {}) {
|
48275
|
-
const [client] = useState(new import_letta_client.LettaClient(options));
|
48276
|
-
return client;
|
48277
|
-
}
|
48278
48274
|
export {
|
48279
|
-
getQueryKey,
|
48280
|
-
useLetta,
|
48281
48275
|
useLettaQuery
|
48282
48276
|
};
|
48283
48277
|
/*! Bundled license information:
|