@nimbleflux/fluxbase-sdk-react 2026.3.6 → 2026.3.7-rc.10
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/.nvmrc +1 -1
- package/package.json +10 -10
- package/src/index.test.ts +0 -8
- package/src/index.ts +15 -15
- package/src/use-admin-auth.ts +1 -1
- package/src/use-admin-hooks.ts +122 -113
- package/src/use-auth-config.ts +1 -1
- package/src/use-auth.ts +1 -1
- package/src/use-captcha.ts +2 -2
- package/src/use-client-keys.ts +66 -51
- package/src/use-graphql.ts +14 -9
- package/src/use-query.ts +73 -62
- package/src/use-realtime.ts +6 -2
- package/src/use-saml.ts +1 -1
- package/src/use-storage.test.ts +0 -52
- package/src/use-storage.ts +4 -58
- package/src/use-table-export.ts +31 -420
- package/src/use-tenant.ts +311 -0
- package/src/use-users.ts +56 -55
- package/tsconfig.json +1 -0
- package/tsup.config.ts +1 -1
package/.nvmrc
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
24.14.
|
|
1
|
+
24.14.1
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nimbleflux/fluxbase-sdk-react",
|
|
3
|
-
"version": "2026.3.
|
|
3
|
+
"version": "2026.3.7-rc.10",
|
|
4
4
|
"description": "React hooks for Fluxbase SDK",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -39,27 +39,27 @@
|
|
|
39
39
|
"access": "public"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@nimbleflux/fluxbase-sdk": "^2026.3.
|
|
43
|
-
"@tanstack/react-query": "^5.
|
|
42
|
+
"@nimbleflux/fluxbase-sdk": "^2026.3.7-rc.10",
|
|
43
|
+
"@tanstack/react-query": "^5.96.2",
|
|
44
44
|
"react": "^18.0.0 || ^19.0.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@nimbleflux/fluxbase-sdk": "workspace:*",
|
|
48
|
-
"@tanstack/react-query": "^5.
|
|
48
|
+
"@tanstack/react-query": "^5.96.2",
|
|
49
49
|
"@testing-library/jest-dom": "^6.9.1",
|
|
50
50
|
"@testing-library/react": "^16.3.2",
|
|
51
51
|
"@types/react": "^19.2.14",
|
|
52
|
-
"@vitest/coverage-v8": "^4.
|
|
53
|
-
"jsdom": "^
|
|
52
|
+
"@vitest/coverage-v8": "^4.1.3",
|
|
53
|
+
"jsdom": "^29.0.2",
|
|
54
54
|
"prettier": "^3.8.1",
|
|
55
55
|
"react": "^19.2.4",
|
|
56
56
|
"react-dom": "^19.2.4",
|
|
57
57
|
"tsup": "^8.5.1",
|
|
58
|
-
"typedoc": "^0.28.
|
|
59
|
-
"typescript": "^
|
|
60
|
-
"vitest": "^4.
|
|
58
|
+
"typedoc": "^0.28.18",
|
|
59
|
+
"typescript": "^6.0.2",
|
|
60
|
+
"vitest": "^4.1.3"
|
|
61
61
|
},
|
|
62
62
|
"engines": {
|
|
63
|
-
"node": ">=24.14.
|
|
63
|
+
"node": ">=24.14.1"
|
|
64
64
|
}
|
|
65
65
|
}
|
package/src/index.test.ts
CHANGED
|
@@ -191,14 +191,6 @@ describe('Module Exports', () => {
|
|
|
191
191
|
expect(exports.useStorageSignedUrlWithOptions).toBeDefined();
|
|
192
192
|
});
|
|
193
193
|
|
|
194
|
-
it('should export useStorageMove', () => {
|
|
195
|
-
expect(exports.useStorageMove).toBeDefined();
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
it('should export useStorageCopy', () => {
|
|
199
|
-
expect(exports.useStorageCopy).toBeDefined();
|
|
200
|
-
});
|
|
201
|
-
|
|
202
194
|
it('should export useStorageBuckets', () => {
|
|
203
195
|
expect(exports.useStorageBuckets).toBeDefined();
|
|
204
196
|
});
|
package/src/index.ts
CHANGED
|
@@ -103,8 +103,6 @@ export {
|
|
|
103
103
|
useStorageTransformUrl,
|
|
104
104
|
useStorageSignedUrl,
|
|
105
105
|
useStorageSignedUrlWithOptions,
|
|
106
|
-
useStorageMove,
|
|
107
|
-
useStorageCopy,
|
|
108
106
|
useStorageBuckets,
|
|
109
107
|
useCreateBucket,
|
|
110
108
|
useDeleteBucket,
|
|
@@ -120,24 +118,21 @@ export {
|
|
|
120
118
|
useSystemSettings,
|
|
121
119
|
} from "./use-admin-hooks";
|
|
122
120
|
|
|
121
|
+
// Multi-tenancy hooks
|
|
122
|
+
export {
|
|
123
|
+
useTenants,
|
|
124
|
+
useTenant,
|
|
125
|
+
type UseTenantsOptions,
|
|
126
|
+
type UseTenantsReturn,
|
|
127
|
+
type UseTenantOptions,
|
|
128
|
+
type UseTenantReturn,
|
|
129
|
+
} from "./use-tenant";
|
|
130
|
+
|
|
123
131
|
// Table export hooks
|
|
124
132
|
export {
|
|
125
133
|
useTableDetails,
|
|
126
|
-
useExportTable,
|
|
127
|
-
useTableExportSyncs,
|
|
128
|
-
useCreateTableExportSync,
|
|
129
|
-
useUpdateTableExportSync,
|
|
130
|
-
useDeleteTableExportSync,
|
|
131
|
-
useTriggerTableExportSync,
|
|
132
134
|
type UseTableDetailsOptions,
|
|
133
135
|
type UseTableDetailsReturn,
|
|
134
|
-
type UseExportTableReturn,
|
|
135
|
-
type UseTableExportSyncsOptions,
|
|
136
|
-
type UseTableExportSyncsReturn,
|
|
137
|
-
type UseCreateTableExportSyncReturn,
|
|
138
|
-
type UseUpdateTableExportSyncReturn,
|
|
139
|
-
type UseDeleteTableExportSyncReturn,
|
|
140
|
-
type UseTriggerTableExportSyncReturn,
|
|
141
136
|
} from "./use-table-export";
|
|
142
137
|
|
|
143
138
|
// Re-export types from SDK
|
|
@@ -172,4 +167,9 @@ export type {
|
|
|
172
167
|
GraphQLError,
|
|
173
168
|
GraphQLErrorLocation,
|
|
174
169
|
GraphQLRequestOptions,
|
|
170
|
+
// Multi-tenancy types
|
|
171
|
+
Tenant,
|
|
172
|
+
TenantWithRole,
|
|
173
|
+
CreateTenantOptions,
|
|
174
|
+
UpdateTenantOptions,
|
|
175
175
|
} from "@nimbleflux/fluxbase-sdk";
|
package/src/use-admin-auth.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState, useEffect, useCallback } from "react";
|
|
2
2
|
import { useFluxbaseClient } from "./context";
|
|
3
|
-
import type { AdminAuthResponse
|
|
3
|
+
import type { AdminAuthResponse } from "@nimbleflux/fluxbase-sdk";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Simplified admin user type returned by authentication
|
package/src/use-admin-hooks.ts
CHANGED
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Hooks for managing application settings, system settings, and webhooks.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { useState, useEffect, useCallback } from
|
|
8
|
-
import { useFluxbaseClient } from
|
|
7
|
+
import { useState, useEffect, useCallback } from "react";
|
|
8
|
+
import { useFluxbaseClient } from "./context";
|
|
9
9
|
import type {
|
|
10
10
|
AppSettings,
|
|
11
11
|
UpdateAppSettingsRequest,
|
|
@@ -13,23 +13,23 @@ import type {
|
|
|
13
13
|
UpdateSystemSettingRequest,
|
|
14
14
|
Webhook,
|
|
15
15
|
CreateWebhookRequest,
|
|
16
|
-
UpdateWebhookRequest
|
|
17
|
-
} from
|
|
16
|
+
UpdateWebhookRequest,
|
|
17
|
+
} from "@nimbleflux/fluxbase-sdk";
|
|
18
18
|
|
|
19
19
|
// ============================================================================
|
|
20
20
|
// useAppSettings Hook
|
|
21
21
|
// ============================================================================
|
|
22
22
|
|
|
23
23
|
export interface UseAppSettingsOptions {
|
|
24
|
-
autoFetch?: boolean
|
|
24
|
+
autoFetch?: boolean;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
export interface UseAppSettingsReturn {
|
|
28
|
-
settings: AppSettings | null
|
|
29
|
-
isLoading: boolean
|
|
30
|
-
error: Error | null
|
|
31
|
-
refetch: () => Promise<void
|
|
32
|
-
updateSettings: (update: UpdateAppSettingsRequest) => Promise<void
|
|
28
|
+
settings: AppSettings | null;
|
|
29
|
+
isLoading: boolean;
|
|
30
|
+
error: Error | null;
|
|
31
|
+
refetch: () => Promise<void>;
|
|
32
|
+
updateSettings: (update: UpdateAppSettingsRequest) => Promise<void>;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
/**
|
|
@@ -50,48 +50,50 @@ export interface UseAppSettingsReturn {
|
|
|
50
50
|
* }
|
|
51
51
|
* ```
|
|
52
52
|
*/
|
|
53
|
-
export function useAppSettings(
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
export function useAppSettings(
|
|
54
|
+
options: UseAppSettingsOptions = {},
|
|
55
|
+
): UseAppSettingsReturn {
|
|
56
|
+
const { autoFetch = true } = options;
|
|
57
|
+
const client = useFluxbaseClient();
|
|
56
58
|
|
|
57
|
-
const [settings, setSettings] = useState<AppSettings | null>(null)
|
|
58
|
-
const [isLoading, setIsLoading] = useState(autoFetch)
|
|
59
|
-
const [error, setError] = useState<Error | null>(null)
|
|
59
|
+
const [settings, setSettings] = useState<AppSettings | null>(null);
|
|
60
|
+
const [isLoading, setIsLoading] = useState(autoFetch);
|
|
61
|
+
const [error, setError] = useState<Error | null>(null);
|
|
60
62
|
|
|
61
63
|
const fetchSettings = useCallback(async () => {
|
|
62
64
|
try {
|
|
63
|
-
setIsLoading(true)
|
|
64
|
-
setError(null)
|
|
65
|
-
const appSettings = await client.admin.settings.app.get()
|
|
66
|
-
setSettings(appSettings)
|
|
65
|
+
setIsLoading(true);
|
|
66
|
+
setError(null);
|
|
67
|
+
const appSettings = await client.admin.settings.app.get();
|
|
68
|
+
setSettings(appSettings);
|
|
67
69
|
} catch (err) {
|
|
68
|
-
setError(err as Error)
|
|
70
|
+
setError(err as Error);
|
|
69
71
|
} finally {
|
|
70
|
-
setIsLoading(false)
|
|
72
|
+
setIsLoading(false);
|
|
71
73
|
}
|
|
72
|
-
}, [client])
|
|
74
|
+
}, [client]);
|
|
73
75
|
|
|
74
76
|
const updateSettings = useCallback(
|
|
75
77
|
async (update: UpdateAppSettingsRequest): Promise<void> => {
|
|
76
|
-
await client.admin.settings.app.update(update)
|
|
77
|
-
await fetchSettings()
|
|
78
|
+
await client.admin.settings.app.update(update);
|
|
79
|
+
await fetchSettings();
|
|
78
80
|
},
|
|
79
|
-
[client, fetchSettings]
|
|
80
|
-
)
|
|
81
|
+
[client, fetchSettings],
|
|
82
|
+
);
|
|
81
83
|
|
|
82
84
|
useEffect(() => {
|
|
83
85
|
if (autoFetch) {
|
|
84
|
-
fetchSettings()
|
|
86
|
+
fetchSettings();
|
|
85
87
|
}
|
|
86
|
-
}, [autoFetch, fetchSettings])
|
|
88
|
+
}, [autoFetch, fetchSettings]);
|
|
87
89
|
|
|
88
90
|
return {
|
|
89
91
|
settings,
|
|
90
92
|
isLoading,
|
|
91
93
|
error,
|
|
92
94
|
refetch: fetchSettings,
|
|
93
|
-
updateSettings
|
|
94
|
-
}
|
|
95
|
+
updateSettings,
|
|
96
|
+
};
|
|
95
97
|
}
|
|
96
98
|
|
|
97
99
|
// ============================================================================
|
|
@@ -99,17 +101,20 @@ export function useAppSettings(options: UseAppSettingsOptions = {}): UseAppSetti
|
|
|
99
101
|
// ============================================================================
|
|
100
102
|
|
|
101
103
|
export interface UseSystemSettingsOptions {
|
|
102
|
-
autoFetch?: boolean
|
|
104
|
+
autoFetch?: boolean;
|
|
103
105
|
}
|
|
104
106
|
|
|
105
107
|
export interface UseSystemSettingsReturn {
|
|
106
|
-
settings: SystemSetting[]
|
|
107
|
-
isLoading: boolean
|
|
108
|
-
error: Error | null
|
|
109
|
-
refetch: () => Promise<void
|
|
110
|
-
getSetting: (key: string) => SystemSetting | undefined
|
|
111
|
-
updateSetting: (
|
|
112
|
-
|
|
108
|
+
settings: SystemSetting[];
|
|
109
|
+
isLoading: boolean;
|
|
110
|
+
error: Error | null;
|
|
111
|
+
refetch: () => Promise<void>;
|
|
112
|
+
getSetting: (key: string) => SystemSetting | undefined;
|
|
113
|
+
updateSetting: (
|
|
114
|
+
key: string,
|
|
115
|
+
update: UpdateSystemSettingRequest,
|
|
116
|
+
) => Promise<void>;
|
|
117
|
+
deleteSetting: (key: string) => Promise<void>;
|
|
113
118
|
}
|
|
114
119
|
|
|
115
120
|
/**
|
|
@@ -128,55 +133,57 @@ export interface UseSystemSettingsReturn {
|
|
|
128
133
|
* }
|
|
129
134
|
* ```
|
|
130
135
|
*/
|
|
131
|
-
export function useSystemSettings(
|
|
132
|
-
|
|
133
|
-
|
|
136
|
+
export function useSystemSettings(
|
|
137
|
+
options: UseSystemSettingsOptions = {},
|
|
138
|
+
): UseSystemSettingsReturn {
|
|
139
|
+
const { autoFetch = true } = options;
|
|
140
|
+
const client = useFluxbaseClient();
|
|
134
141
|
|
|
135
|
-
const [settings, setSettings] = useState<SystemSetting[]>([])
|
|
136
|
-
const [isLoading, setIsLoading] = useState(autoFetch)
|
|
137
|
-
const [error, setError] = useState<Error | null>(null)
|
|
142
|
+
const [settings, setSettings] = useState<SystemSetting[]>([]);
|
|
143
|
+
const [isLoading, setIsLoading] = useState(autoFetch);
|
|
144
|
+
const [error, setError] = useState<Error | null>(null);
|
|
138
145
|
|
|
139
146
|
const fetchSettings = useCallback(async () => {
|
|
140
147
|
try {
|
|
141
|
-
setIsLoading(true)
|
|
142
|
-
setError(null)
|
|
143
|
-
const response = await client.admin.settings.system.list()
|
|
144
|
-
setSettings(response.settings)
|
|
148
|
+
setIsLoading(true);
|
|
149
|
+
setError(null);
|
|
150
|
+
const response = await client.admin.settings.system.list();
|
|
151
|
+
setSettings(response.settings);
|
|
145
152
|
} catch (err) {
|
|
146
|
-
setError(err as Error)
|
|
153
|
+
setError(err as Error);
|
|
147
154
|
} finally {
|
|
148
|
-
setIsLoading(false)
|
|
155
|
+
setIsLoading(false);
|
|
149
156
|
}
|
|
150
|
-
}, [client])
|
|
157
|
+
}, [client]);
|
|
151
158
|
|
|
152
159
|
const getSetting = useCallback(
|
|
153
160
|
(key: string): SystemSetting | undefined => {
|
|
154
|
-
return settings.find((s) => s.key === key)
|
|
161
|
+
return settings.find((s) => s.key === key);
|
|
155
162
|
},
|
|
156
|
-
[settings]
|
|
157
|
-
)
|
|
163
|
+
[settings],
|
|
164
|
+
);
|
|
158
165
|
|
|
159
166
|
const updateSetting = useCallback(
|
|
160
167
|
async (key: string, update: UpdateSystemSettingRequest): Promise<void> => {
|
|
161
|
-
await client.admin.settings.system.update(key, update)
|
|
162
|
-
await fetchSettings()
|
|
168
|
+
await client.admin.settings.system.update(key, update);
|
|
169
|
+
await fetchSettings();
|
|
163
170
|
},
|
|
164
|
-
[client, fetchSettings]
|
|
165
|
-
)
|
|
171
|
+
[client, fetchSettings],
|
|
172
|
+
);
|
|
166
173
|
|
|
167
174
|
const deleteSetting = useCallback(
|
|
168
175
|
async (key: string): Promise<void> => {
|
|
169
|
-
await client.admin.settings.system.delete(key)
|
|
170
|
-
await fetchSettings()
|
|
176
|
+
await client.admin.settings.system.delete(key);
|
|
177
|
+
await fetchSettings();
|
|
171
178
|
},
|
|
172
|
-
[client, fetchSettings]
|
|
173
|
-
)
|
|
179
|
+
[client, fetchSettings],
|
|
180
|
+
);
|
|
174
181
|
|
|
175
182
|
useEffect(() => {
|
|
176
183
|
if (autoFetch) {
|
|
177
|
-
fetchSettings()
|
|
184
|
+
fetchSettings();
|
|
178
185
|
}
|
|
179
|
-
}, [autoFetch, fetchSettings])
|
|
186
|
+
}, [autoFetch, fetchSettings]);
|
|
180
187
|
|
|
181
188
|
return {
|
|
182
189
|
settings,
|
|
@@ -185,8 +192,8 @@ export function useSystemSettings(options: UseSystemSettingsOptions = {}): UseSy
|
|
|
185
192
|
refetch: fetchSettings,
|
|
186
193
|
getSetting,
|
|
187
194
|
updateSetting,
|
|
188
|
-
deleteSetting
|
|
189
|
-
}
|
|
195
|
+
deleteSetting,
|
|
196
|
+
};
|
|
190
197
|
}
|
|
191
198
|
|
|
192
199
|
// ============================================================================
|
|
@@ -194,19 +201,19 @@ export function useSystemSettings(options: UseSystemSettingsOptions = {}): UseSy
|
|
|
194
201
|
// ============================================================================
|
|
195
202
|
|
|
196
203
|
export interface UseWebhooksOptions {
|
|
197
|
-
autoFetch?: boolean
|
|
198
|
-
refetchInterval?: number
|
|
204
|
+
autoFetch?: boolean;
|
|
205
|
+
refetchInterval?: number;
|
|
199
206
|
}
|
|
200
207
|
|
|
201
208
|
export interface UseWebhooksReturn {
|
|
202
|
-
webhooks: Webhook[]
|
|
203
|
-
isLoading: boolean
|
|
204
|
-
error: Error | null
|
|
205
|
-
refetch: () => Promise<void
|
|
206
|
-
createWebhook: (webhook: CreateWebhookRequest) => Promise<Webhook
|
|
207
|
-
updateWebhook: (id: string, update: UpdateWebhookRequest) => Promise<Webhook
|
|
208
|
-
deleteWebhook: (id: string) => Promise<void
|
|
209
|
-
testWebhook: (id: string) => Promise<void
|
|
209
|
+
webhooks: Webhook[];
|
|
210
|
+
isLoading: boolean;
|
|
211
|
+
error: Error | null;
|
|
212
|
+
refetch: () => Promise<void>;
|
|
213
|
+
createWebhook: (webhook: CreateWebhookRequest) => Promise<Webhook>;
|
|
214
|
+
updateWebhook: (id: string, update: UpdateWebhookRequest) => Promise<Webhook>;
|
|
215
|
+
deleteWebhook: (id: string) => Promise<void>;
|
|
216
|
+
testWebhook: (id: string) => Promise<void>;
|
|
210
217
|
}
|
|
211
218
|
|
|
212
219
|
/**
|
|
@@ -231,70 +238,72 @@ export interface UseWebhooksReturn {
|
|
|
231
238
|
* }
|
|
232
239
|
* ```
|
|
233
240
|
*/
|
|
234
|
-
export function useWebhooks(
|
|
235
|
-
|
|
236
|
-
|
|
241
|
+
export function useWebhooks(
|
|
242
|
+
options: UseWebhooksOptions = {},
|
|
243
|
+
): UseWebhooksReturn {
|
|
244
|
+
const { autoFetch = true, refetchInterval = 0 } = options;
|
|
245
|
+
const client = useFluxbaseClient();
|
|
237
246
|
|
|
238
|
-
const [webhooks, setWebhooks] = useState<Webhook[]>([])
|
|
239
|
-
const [isLoading, setIsLoading] = useState(autoFetch)
|
|
240
|
-
const [error, setError] = useState<Error | null>(null)
|
|
247
|
+
const [webhooks, setWebhooks] = useState<Webhook[]>([]);
|
|
248
|
+
const [isLoading, setIsLoading] = useState(autoFetch);
|
|
249
|
+
const [error, setError] = useState<Error | null>(null);
|
|
241
250
|
|
|
242
251
|
const fetchWebhooks = useCallback(async () => {
|
|
243
252
|
try {
|
|
244
|
-
setIsLoading(true)
|
|
245
|
-
setError(null)
|
|
246
|
-
const response = await client.admin.management.webhooks.list()
|
|
247
|
-
setWebhooks(response.webhooks)
|
|
253
|
+
setIsLoading(true);
|
|
254
|
+
setError(null);
|
|
255
|
+
const response = await client.admin.management.webhooks.list();
|
|
256
|
+
setWebhooks(response.webhooks);
|
|
248
257
|
} catch (err) {
|
|
249
|
-
setError(err as Error)
|
|
258
|
+
setError(err as Error);
|
|
250
259
|
} finally {
|
|
251
|
-
setIsLoading(false)
|
|
260
|
+
setIsLoading(false);
|
|
252
261
|
}
|
|
253
|
-
}, [client])
|
|
262
|
+
}, [client]);
|
|
254
263
|
|
|
255
264
|
const createWebhook = useCallback(
|
|
256
265
|
async (webhook: CreateWebhookRequest): Promise<Webhook> => {
|
|
257
|
-
const created = await client.admin.management.webhooks.create(webhook)
|
|
258
|
-
await fetchWebhooks()
|
|
259
|
-
return created
|
|
266
|
+
const created = await client.admin.management.webhooks.create(webhook);
|
|
267
|
+
await fetchWebhooks();
|
|
268
|
+
return created;
|
|
260
269
|
},
|
|
261
|
-
[client, fetchWebhooks]
|
|
262
|
-
)
|
|
270
|
+
[client, fetchWebhooks],
|
|
271
|
+
);
|
|
263
272
|
|
|
264
273
|
const updateWebhook = useCallback(
|
|
265
274
|
async (id: string, update: UpdateWebhookRequest): Promise<Webhook> => {
|
|
266
|
-
const updated = await client.admin.management.webhooks.update(id, update)
|
|
267
|
-
await fetchWebhooks()
|
|
268
|
-
return updated
|
|
275
|
+
const updated = await client.admin.management.webhooks.update(id, update);
|
|
276
|
+
await fetchWebhooks();
|
|
277
|
+
return updated;
|
|
269
278
|
},
|
|
270
|
-
[client, fetchWebhooks]
|
|
271
|
-
)
|
|
279
|
+
[client, fetchWebhooks],
|
|
280
|
+
);
|
|
272
281
|
|
|
273
282
|
const deleteWebhook = useCallback(
|
|
274
283
|
async (id: string): Promise<void> => {
|
|
275
|
-
await client.admin.management.webhooks.delete(id)
|
|
276
|
-
await fetchWebhooks()
|
|
284
|
+
await client.admin.management.webhooks.delete(id);
|
|
285
|
+
await fetchWebhooks();
|
|
277
286
|
},
|
|
278
|
-
[client, fetchWebhooks]
|
|
279
|
-
)
|
|
287
|
+
[client, fetchWebhooks],
|
|
288
|
+
);
|
|
280
289
|
|
|
281
290
|
const testWebhook = useCallback(
|
|
282
291
|
async (id: string): Promise<void> => {
|
|
283
|
-
await client.admin.management.webhooks.test(id)
|
|
292
|
+
await client.admin.management.webhooks.test(id);
|
|
284
293
|
},
|
|
285
|
-
[client]
|
|
286
|
-
)
|
|
294
|
+
[client],
|
|
295
|
+
);
|
|
287
296
|
|
|
288
297
|
useEffect(() => {
|
|
289
298
|
if (autoFetch) {
|
|
290
|
-
fetchWebhooks()
|
|
299
|
+
fetchWebhooks();
|
|
291
300
|
}
|
|
292
301
|
|
|
293
302
|
if (refetchInterval > 0) {
|
|
294
|
-
const interval = setInterval(fetchWebhooks, refetchInterval)
|
|
295
|
-
return () => clearInterval(interval)
|
|
303
|
+
const interval = setInterval(fetchWebhooks, refetchInterval);
|
|
304
|
+
return () => clearInterval(interval);
|
|
296
305
|
}
|
|
297
|
-
}, [autoFetch, refetchInterval, fetchWebhooks])
|
|
306
|
+
}, [autoFetch, refetchInterval, fetchWebhooks]);
|
|
298
307
|
|
|
299
308
|
return {
|
|
300
309
|
webhooks,
|
|
@@ -304,6 +313,6 @@ export function useWebhooks(options: UseWebhooksOptions = {}): UseWebhooksReturn
|
|
|
304
313
|
createWebhook,
|
|
305
314
|
updateWebhook,
|
|
306
315
|
deleteWebhook,
|
|
307
|
-
testWebhook
|
|
308
|
-
}
|
|
316
|
+
testWebhook,
|
|
317
|
+
};
|
|
309
318
|
}
|
package/src/use-auth-config.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import { useQuery } from "@tanstack/react-query";
|
|
10
10
|
import { useFluxbaseClient } from "./context";
|
|
11
|
-
import type { AuthConfig } from "@fluxbase
|
|
11
|
+
import type { AuthConfig } from "@nimbleflux/fluxbase-sdk";
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Hook to get the complete authentication configuration from the server
|
package/src/use-auth.ts
CHANGED
package/src/use-captcha.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import { useQuery } from "@tanstack/react-query";
|
|
10
10
|
import { useFluxbaseClient } from "./context";
|
|
11
|
-
import type { CaptchaConfig, CaptchaProvider } from "@fluxbase
|
|
11
|
+
import type { CaptchaConfig, CaptchaProvider } from "@nimbleflux/fluxbase-sdk";
|
|
12
12
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -241,7 +241,7 @@ export function useCaptcha(provider?: CaptchaProvider): CaptchaState {
|
|
|
241
241
|
*/
|
|
242
242
|
export function isCaptchaRequiredForEndpoint(
|
|
243
243
|
config: CaptchaConfig | undefined,
|
|
244
|
-
endpoint: string
|
|
244
|
+
endpoint: string,
|
|
245
245
|
): boolean {
|
|
246
246
|
if (!config?.enabled) {
|
|
247
247
|
return false;
|