@raystack/frontier 0.108.0 → 0.109.0
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/admin/dist/index.d.ts +1 -13
- package/admin/dist/index.js +7028 -8726
- package/admin/dist/index.mjs +6987 -8717
- package/client/dist/index.js +1005 -1121
- package/client/dist/index.mjs +1037 -1178
- package/hooks/dist/index.d.ts +16 -1
- package/hooks/dist/index.js +13 -0
- package/hooks/dist/index.mjs +12 -0
- package/package.json +3 -3
package/hooks/dist/index.d.ts
CHANGED
|
@@ -16,4 +16,19 @@ type ErrorHandlerMap = {
|
|
|
16
16
|
};
|
|
17
17
|
declare function handleConnectError(error: unknown, handlers?: ErrorHandlerMap): void;
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
/**
|
|
20
|
+
* Returns a debounced copy of `value` that only updates after `delay`
|
|
21
|
+
* milliseconds have elapsed without `value` changing.
|
|
22
|
+
*
|
|
23
|
+
* Unlike a debounced *setter* (which delays writes to state), this debounces
|
|
24
|
+
* the *value* itself, so it can wrap a derived/computed value (e.g. a memoized
|
|
25
|
+
* request query) while the source state stays instant. The debounce runs inside
|
|
26
|
+
* an effect (post-commit), which is safe under React's concurrent rendering.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* const computedQuery = useMemo(() => transform(tableQuery), [tableQuery]);
|
|
30
|
+
* const query = useDebouncedValue(computedQuery, 200);
|
|
31
|
+
*/
|
|
32
|
+
declare function useDebouncedValue<T>(value: T, delay: number): T;
|
|
33
|
+
|
|
34
|
+
export { handleConnectError, useDebouncedValue };
|
package/hooks/dist/index.js
CHANGED
|
@@ -27,6 +27,7 @@ __export(hooks_exports, {
|
|
|
27
27
|
create: () => import_protobuf.create,
|
|
28
28
|
createConnectQueryKey: () => import_connect_query.createConnectQueryKey,
|
|
29
29
|
handleConnectError: () => handleConnectError,
|
|
30
|
+
useDebouncedValue: () => useDebouncedValue,
|
|
30
31
|
useInfiniteQuery: () => import_connect_query.useInfiniteQuery,
|
|
31
32
|
useMutation: () => import_connect_query.useMutation,
|
|
32
33
|
useQuery: () => import_connect_query.useQuery,
|
|
@@ -71,6 +72,17 @@ function handleConnectError(error, handlers) {
|
|
|
71
72
|
var import_frontier = require("@raystack/proton/frontier");
|
|
72
73
|
var import_react_query = require("@tanstack/react-query");
|
|
73
74
|
var import_protobuf = require("@bufbuild/protobuf");
|
|
75
|
+
|
|
76
|
+
// hooks/useDebouncedValue.ts
|
|
77
|
+
var import_react = require("react");
|
|
78
|
+
function useDebouncedValue(value, delay) {
|
|
79
|
+
const [debouncedValue, setDebouncedValue] = (0, import_react.useState)(value);
|
|
80
|
+
(0, import_react.useEffect)(() => {
|
|
81
|
+
const timer = setTimeout(() => setDebouncedValue(value), delay);
|
|
82
|
+
return () => clearTimeout(timer);
|
|
83
|
+
}, [value, delay]);
|
|
84
|
+
return debouncedValue;
|
|
85
|
+
}
|
|
74
86
|
// Annotate the CommonJS export names for ESM import in node:
|
|
75
87
|
0 && (module.exports = {
|
|
76
88
|
Code,
|
|
@@ -79,6 +91,7 @@ var import_protobuf = require("@bufbuild/protobuf");
|
|
|
79
91
|
create,
|
|
80
92
|
createConnectQueryKey,
|
|
81
93
|
handleConnectError,
|
|
94
|
+
useDebouncedValue,
|
|
82
95
|
useInfiniteQuery,
|
|
83
96
|
useMutation,
|
|
84
97
|
useQuery,
|
package/hooks/dist/index.mjs
CHANGED
|
@@ -44,6 +44,17 @@ function handleConnectError(error, handlers) {
|
|
|
44
44
|
import { FrontierServiceQueries } from "@raystack/proton/frontier";
|
|
45
45
|
import { useQueryClient } from "@tanstack/react-query";
|
|
46
46
|
import { create } from "@bufbuild/protobuf";
|
|
47
|
+
|
|
48
|
+
// hooks/useDebouncedValue.ts
|
|
49
|
+
import { useEffect, useState } from "react";
|
|
50
|
+
function useDebouncedValue(value, delay) {
|
|
51
|
+
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
52
|
+
useEffect(() => {
|
|
53
|
+
const timer = setTimeout(() => setDebouncedValue(value), delay);
|
|
54
|
+
return () => clearTimeout(timer);
|
|
55
|
+
}, [value, delay]);
|
|
56
|
+
return debouncedValue;
|
|
57
|
+
}
|
|
47
58
|
export {
|
|
48
59
|
Code2 as Code,
|
|
49
60
|
ConnectError2 as ConnectError,
|
|
@@ -51,6 +62,7 @@ export {
|
|
|
51
62
|
create,
|
|
52
63
|
createConnectQueryKey,
|
|
53
64
|
handleConnectError,
|
|
65
|
+
useDebouncedValue,
|
|
54
66
|
useInfiniteQuery,
|
|
55
67
|
useMutation,
|
|
56
68
|
useQuery,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raystack/frontier",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.109.0",
|
|
4
4
|
"description": "A js library for frontier",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@jest/globals": "^29.7.0",
|
|
69
69
|
"@radix-ui/react-form": "^0.1.8",
|
|
70
70
|
"@radix-ui/react-icons": "^1.3.2",
|
|
71
|
-
"@raystack/apsara": "1.
|
|
71
|
+
"@raystack/apsara": "^1.1.0",
|
|
72
72
|
"@raystack/eslint-config": "workspace:^",
|
|
73
73
|
"@raystack/frontier-tsconfig": "workspace:^",
|
|
74
74
|
"@size-limit/preset-small-lib": "^8.2.6",
|
|
@@ -101,7 +101,7 @@
|
|
|
101
101
|
"@connectrpc/connect-query": "2.1.1",
|
|
102
102
|
"@connectrpc/connect-web": "2.1.1",
|
|
103
103
|
"@hookform/resolvers": "^3.10.0",
|
|
104
|
-
"@raystack/proton": "0.1.0-
|
|
104
|
+
"@raystack/proton": "0.1.0-f0b06e61f1985a9052f32744976a2b73d8c56839",
|
|
105
105
|
"@tanstack/react-query": "^5.90.2",
|
|
106
106
|
"@tanstack/react-router": "^1.168.3",
|
|
107
107
|
"axios": "^1.9.0",
|