@reopt-ai/brandapp-sdk 3.1.0 → 3.4.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.
Files changed (104) hide show
  1. package/CHANGELOG.md +147 -0
  2. package/README.md +39 -14
  3. package/dist/abort--nOBFN4M.js +50 -0
  4. package/dist/ai/index.d.ts +2 -314
  5. package/dist/ai/index.js +3 -7
  6. package/dist/ai-provider/index.d.ts +79 -163
  7. package/dist/ai-provider/index.js +752 -671
  8. package/dist/auth/index.d.ts +27 -27
  9. package/dist/auth/index.js +41 -33
  10. package/dist/better-auth/client.d.ts +6 -5
  11. package/dist/better-auth/client.js +28 -5
  12. package/dist/better-auth/index.d.ts +19 -17
  13. package/dist/better-auth/index.js +180 -133
  14. package/dist/client-B1q5P8rv.js +83 -0
  15. package/dist/client-B9QHVhdM.js +77 -0
  16. package/dist/client-BGGd_cpV.d.ts +103 -0
  17. package/dist/client-BJcy1V1a.js +140 -0
  18. package/dist/client-Beivhucf.js +55 -0
  19. package/dist/client-BruP5_nU.d.ts +147 -0
  20. package/dist/client-D-yNxNfk.js +28 -0
  21. package/dist/client-D0eBxh8j.d.ts +284 -0
  22. package/dist/client-D3RHHUUW.d.ts +207 -0
  23. package/dist/client-D6gs61w8.d.ts +53 -0
  24. package/dist/client-DBnK7ooQ.js +86 -0
  25. package/dist/client-DDw5yz_h.d.ts +53 -0
  26. package/dist/client-DPmoKuR9.js +305 -0
  27. package/dist/client-DsdakibF.js +503 -0
  28. package/dist/client-Dxg8_DIH.d.ts +71 -0
  29. package/dist/client-EbhUIhHq.js +53 -0
  30. package/dist/client-lk6wBu_0.d.ts +48 -0
  31. package/dist/client-p49ol9pg.d.ts +124 -0
  32. package/dist/cms/index.d.ts +52 -108
  33. package/dist/cms/index.js +105 -84
  34. package/dist/config-CRytOPPl.d.ts +394 -0
  35. package/dist/config-Cw0a3-C8.js +487 -0
  36. package/dist/dev/index.d.ts +2 -509
  37. package/dist/dev/index.js +2740 -2873
  38. package/dist/eav/coerce.d.ts +3 -1
  39. package/dist/eav/coerce.js +72 -46
  40. package/dist/eav/index.d.ts +72 -100
  41. package/dist/eav/index.js +158 -125
  42. package/dist/eav/migrate.d.ts +112 -109
  43. package/dist/eav/migrate.js +230 -196
  44. package/dist/eav/schema.d.ts +111 -150
  45. package/dist/eav/schema.js +624 -603
  46. package/dist/encoding-Bwfm3iaE.js +21 -0
  47. package/dist/{errors-DIAS8Rsl.d.ts → errors-CRCcErNC.d.ts} +55 -53
  48. package/dist/feedback/index.d.ts +2 -132
  49. package/dist/feedback/index.js +3 -5
  50. package/dist/files/index.d.ts +14 -14
  51. package/dist/files/index.js +41 -24
  52. package/dist/http-client-QKUvvirs.js +386 -0
  53. package/dist/index-DrVaKfhs.d.ts +456 -0
  54. package/dist/index-Z6OGcurJ.d.ts +169 -0
  55. package/dist/index.d.ts +6 -221
  56. package/dist/index.js +119 -70
  57. package/dist/logout/index.d.ts +109 -0
  58. package/dist/logout/index.js +264 -0
  59. package/dist/plans/index.d.ts +2 -236
  60. package/dist/plans/index.js +3 -5
  61. package/dist/push/index.d.ts +2 -79
  62. package/dist/push/index.js +3 -5
  63. package/dist/query-BvbCiGWb.js +35 -0
  64. package/dist/react/hooks.d.ts +97 -95
  65. package/dist/react/hooks.js +742 -356
  66. package/dist/sse-parser-FMjxM7sY.js +86 -0
  67. package/dist/terms/index.d.ts +3 -79
  68. package/dist/terms/index.js +3 -5
  69. package/dist/testing/index.d.ts +52 -104
  70. package/dist/testing/index.js +94 -72
  71. package/dist/types-B-SMkH6s.d.ts +26 -0
  72. package/dist/types-BXDcoJHG.d.ts +131 -0
  73. package/dist/types-BrghN2rJ.d.ts +105 -0
  74. package/dist/types-DjDRszNj.js +11 -0
  75. package/dist/webhooks/index.d.ts +77 -47
  76. package/dist/webhooks/index.js +150 -127
  77. package/docs/api-reference.md +179 -2
  78. package/docs/dev-server.md +19 -18
  79. package/docs/errors.md +72 -15
  80. package/docs/logout.md +166 -0
  81. package/package.json +10 -5
  82. package/dist/chunk-2Q654O63.js +0 -350
  83. package/dist/chunk-F7BXBTZI.js +0 -54
  84. package/dist/chunk-IJOXTBIE.js +0 -599
  85. package/dist/chunk-JWXUVQRC.js +0 -157
  86. package/dist/chunk-L4DHB36G.js +0 -75
  87. package/dist/chunk-MRQY45U5.js +0 -465
  88. package/dist/chunk-N5JVE4WX.js +0 -449
  89. package/dist/chunk-O3PUWIDJ.js +0 -105
  90. package/dist/chunk-POLKEOYH.js +0 -63
  91. package/dist/chunk-R5CCGDUH.js +0 -49
  92. package/dist/chunk-RBHP7IZF.js +0 -96
  93. package/dist/chunk-REIKXSMY.js +0 -7
  94. package/dist/chunk-T7YTITRJ.js +0 -112
  95. package/dist/chunk-V73GORO3.js +0 -81
  96. package/dist/chunk-VRNBYSWU.js +0 -32
  97. package/dist/client-BkcO-0C2.d.ts +0 -216
  98. package/dist/client-CN5_tNOC.d.ts +0 -147
  99. package/dist/client-DttyeM_h.d.ts +0 -102
  100. package/dist/config-CtxyJsDR.d.ts +0 -397
  101. package/dist/typed-client-BxOVIiMU.d.ts +0 -40
  102. package/dist/types-6E3ZLL9X.d.ts +0 -24
  103. package/dist/types-DskYLVb8.d.ts +0 -104
  104. package/dist/types-ckmDDW3N.d.ts +0 -129
@@ -1,421 +1,807 @@
1
- import { useState, useRef, useEffect, useCallback } from 'react';
2
- import { useQuery, useInfiniteQuery, useQueryClient, useMutation } from '@tanstack/react-query';
1
+ "use client";
3
2
 
4
- var hasRaf = typeof requestAnimationFrame === "function";
3
+ import { useCallback, useEffect, useRef, useState } from "react";
4
+ import { useInfiniteQuery, useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
5
+
6
+ //#region src/react/use-ai-stream.ts
7
+ /**
8
+ * React hook for AI text streaming via BrandApp SDK.
9
+ *
10
+ * Uses `sdk.ai.streamWithMetadata()` internally to provide
11
+ * incremental text accumulation, abort support, and usage metadata.
12
+ *
13
+ * @example
14
+ * ```tsx
15
+ * const { text, isStreaming, generate, stop } = useAiStream(sdk);
16
+ *
17
+ * return (
18
+ * <div>
19
+ * <button onClick={() => generate({ messages: [{ role: "user", content: "Hello" }] })}>
20
+ * Generate
21
+ * </button>
22
+ * <button onClick={stop} disabled={!isStreaming}>Stop</button>
23
+ * <p>{text}</p>
24
+ * </div>
25
+ * );
26
+ * ```
27
+ */
28
+ const hasRaf = typeof requestAnimationFrame === "function";
5
29
  function useAiStream(sdk, options) {
6
- const [text, setText] = useState("");
7
- const [isStreaming, setIsStreaming] = useState(false);
8
- const [error, setError] = useState(null);
9
- const [metadata, setMetadata] = useState(null);
10
- const controllerRef = useRef(null);
11
- const optionsRef = useRef(options);
12
- const pendingTextRef = useRef("");
13
- const rafRef = useRef(null);
14
- useEffect(() => {
15
- optionsRef.current = options;
16
- }, [options]);
17
- const cancelTextFlush = useCallback(() => {
18
- if (rafRef.current !== null) {
19
- cancelAnimationFrame(rafRef.current);
20
- rafRef.current = null;
21
- }
22
- }, []);
23
- const commitText = useCallback(() => {
24
- cancelTextFlush();
25
- setText(pendingTextRef.current);
26
- }, [cancelTextFlush]);
27
- const scheduleTextFlush = useCallback(() => {
28
- if (!hasRaf) {
29
- setText(pendingTextRef.current);
30
- return;
31
- }
32
- if (rafRef.current !== null) return;
33
- rafRef.current = requestAnimationFrame(() => {
34
- rafRef.current = null;
35
- setText(pendingTextRef.current);
36
- });
37
- }, []);
38
- const stop = useCallback(() => {
39
- cancelTextFlush();
40
- controllerRef.current?.abort();
41
- controllerRef.current = null;
42
- }, [cancelTextFlush]);
43
- const reset = useCallback(() => {
44
- stop();
45
- pendingTextRef.current = "";
46
- setText("");
47
- setError(null);
48
- setMetadata(null);
49
- setIsStreaming(false);
50
- }, [stop]);
51
- useEffect(() => {
52
- return () => {
53
- cancelTextFlush();
54
- controllerRef.current?.abort();
55
- controllerRef.current = null;
56
- };
57
- }, [cancelTextFlush]);
58
- const generate = useCallback(
59
- (completionOptions) => {
60
- stop();
61
- const controller = new AbortController();
62
- controllerRef.current = controller;
63
- pendingTextRef.current = "";
64
- setText("");
65
- setError(null);
66
- setMetadata(null);
67
- setIsStreaming(true);
68
- const { textStream, metadata: metaPromise } = sdk.ai.streamWithMetadata({
69
- ...completionOptions,
70
- signal: controller.signal
71
- });
72
- (async () => {
73
- try {
74
- let accumulated = "";
75
- for await (const chunk of textStream) {
76
- if (controller.signal.aborted) break;
77
- accumulated += chunk;
78
- pendingTextRef.current = accumulated;
79
- scheduleTextFlush();
80
- optionsRef.current?.onChunk?.(chunk);
81
- }
82
- const meta = await metaPromise;
83
- if (!controller.signal.aborted) {
84
- commitText();
85
- setMetadata(meta);
86
- optionsRef.current?.onFinish?.(accumulated, meta);
87
- }
88
- } catch (err) {
89
- if (!controller.signal.aborted) {
90
- commitText();
91
- const e = err instanceof Error ? err : new Error(String(err));
92
- setError(e);
93
- optionsRef.current?.onError?.(e);
94
- }
95
- } finally {
96
- if (controllerRef.current === controller) {
97
- setIsStreaming(false);
98
- controllerRef.current = null;
99
- }
100
- }
101
- })();
102
- },
103
- [sdk, stop, scheduleTextFlush, commitText]
104
- );
105
- return { text, isStreaming, error, metadata, generate, stop, reset };
30
+ const [text, setText] = useState("");
31
+ const [isStreaming, setIsStreaming] = useState(false);
32
+ const [error, setError] = useState(null);
33
+ const [metadata, setMetadata] = useState(null);
34
+ const controllerRef = useRef(null);
35
+ const optionsRef = useRef(options);
36
+ const pendingTextRef = useRef("");
37
+ const rafRef = useRef(null);
38
+ useEffect(() => {
39
+ optionsRef.current = options;
40
+ }, [options]);
41
+ const cancelTextFlush = useCallback(() => {
42
+ if (rafRef.current !== null) {
43
+ cancelAnimationFrame(rafRef.current);
44
+ rafRef.current = null;
45
+ }
46
+ }, []);
47
+ const commitText = useCallback(() => {
48
+ cancelTextFlush();
49
+ setText(pendingTextRef.current);
50
+ }, [cancelTextFlush]);
51
+ const scheduleTextFlush = useCallback(() => {
52
+ if (!hasRaf) {
53
+ setText(pendingTextRef.current);
54
+ return;
55
+ }
56
+ if (rafRef.current !== null) return;
57
+ rafRef.current = requestAnimationFrame(() => {
58
+ rafRef.current = null;
59
+ setText(pendingTextRef.current);
60
+ });
61
+ }, []);
62
+ const stop = useCallback(() => {
63
+ cancelTextFlush();
64
+ controllerRef.current?.abort();
65
+ controllerRef.current = null;
66
+ }, [cancelTextFlush]);
67
+ const reset = useCallback(() => {
68
+ stop();
69
+ pendingTextRef.current = "";
70
+ setText("");
71
+ setError(null);
72
+ setMetadata(null);
73
+ setIsStreaming(false);
74
+ }, [stop]);
75
+ useEffect(() => {
76
+ return () => {
77
+ cancelTextFlush();
78
+ controllerRef.current?.abort();
79
+ controllerRef.current = null;
80
+ };
81
+ }, [cancelTextFlush]);
82
+ return {
83
+ text,
84
+ isStreaming,
85
+ error,
86
+ metadata,
87
+ generate: useCallback((completionOptions) => {
88
+ stop();
89
+ const controller = new AbortController();
90
+ controllerRef.current = controller;
91
+ pendingTextRef.current = "";
92
+ setText("");
93
+ setError(null);
94
+ setMetadata(null);
95
+ setIsStreaming(true);
96
+ const { textStream, metadata: metaPromise } = sdk.ai.streamWithMetadata({
97
+ ...completionOptions,
98
+ signal: controller.signal
99
+ });
100
+ (async () => {
101
+ try {
102
+ let accumulated = "";
103
+ for await (const chunk of textStream) {
104
+ if (controller.signal.aborted) break;
105
+ accumulated += chunk;
106
+ pendingTextRef.current = accumulated;
107
+ scheduleTextFlush();
108
+ optionsRef.current?.onChunk?.(chunk);
109
+ }
110
+ const meta = await metaPromise;
111
+ if (!controller.signal.aborted) {
112
+ commitText();
113
+ setMetadata(meta);
114
+ optionsRef.current?.onFinish?.(accumulated, meta);
115
+ }
116
+ } catch (err) {
117
+ if (!controller.signal.aborted) {
118
+ commitText();
119
+ const e = err instanceof Error ? err : new Error(String(err));
120
+ setError(e);
121
+ optionsRef.current?.onError?.(e);
122
+ }
123
+ } finally {
124
+ if (controllerRef.current === controller) {
125
+ setIsStreaming(false);
126
+ controllerRef.current = null;
127
+ }
128
+ }
129
+ })();
130
+ }, [
131
+ sdk,
132
+ stop,
133
+ scheduleTextFlush,
134
+ commitText
135
+ ]),
136
+ stop,
137
+ reset
138
+ };
106
139
  }
107
- var keys = {
108
- all: ["reopt"],
109
- entities: (brandappId) => [...keys.all, "entities", brandappId],
110
- entity: (entityId) => [...keys.all, "entity", entityId],
111
- records: (entityId, query) => [...keys.all, "records", entityId, query],
112
- record: (entityId, recordId) => [...keys.all, "record", entityId, recordId],
113
- recordCount: (entityId, query) => [...keys.all, "recordCount", entityId, query],
114
- aiCredits: (brandappId) => [...keys.all, "ai", "credits", brandappId],
115
- aiModels: (brandappId) => [...keys.all, "ai", "models", brandappId],
116
- aiAgents: (brandappId) => [...keys.all, "ai", "agents", brandappId],
117
- posts: (brandappId, query) => [...keys.all, "posts", brandappId, query],
118
- post: (postId) => [...keys.all, "post", postId],
119
- postGroups: (brandappId, query) => [...keys.all, "postGroups", brandappId, query],
120
- postGroup: (groupId) => [...keys.all, "postGroup", groupId],
121
- tags: (brandappId, query) => [...keys.all, "tags", brandappId, query],
122
- files: (brandappId, query) => [...keys.all, "files", brandappId, query],
123
- file: (fileId) => [...keys.all, "file", fileId]
140
+
141
+ //#endregion
142
+ //#region src/react/hooks.ts
143
+ const keys = {
144
+ all: ["reopt"],
145
+ entities: (brandappId) => [
146
+ ...keys.all,
147
+ "entities",
148
+ brandappId
149
+ ],
150
+ entity: (entityId) => [
151
+ ...keys.all,
152
+ "entity",
153
+ entityId
154
+ ],
155
+ records: (entityId, query) => [
156
+ ...keys.all,
157
+ "records",
158
+ entityId,
159
+ query
160
+ ],
161
+ recordsInfinite: (entityId, query) => [
162
+ ...keys.all,
163
+ "recordsInfinite",
164
+ entityId,
165
+ query
166
+ ],
167
+ record: (entityId, recordId) => [
168
+ ...keys.all,
169
+ "record",
170
+ entityId,
171
+ recordId
172
+ ],
173
+ recordCount: (entityId, query) => [
174
+ ...keys.all,
175
+ "recordCount",
176
+ entityId,
177
+ query
178
+ ],
179
+ recordsPrefix: (entityId) => [
180
+ ...keys.all,
181
+ "records",
182
+ entityId
183
+ ],
184
+ recordsInfinitePrefix: (entityId) => [
185
+ ...keys.all,
186
+ "recordsInfinite",
187
+ entityId
188
+ ],
189
+ recordCountPrefix: (entityId) => [
190
+ ...keys.all,
191
+ "recordCount",
192
+ entityId
193
+ ],
194
+ aiCredits: (brandappId) => [
195
+ ...keys.all,
196
+ "ai",
197
+ "credits",
198
+ brandappId
199
+ ],
200
+ aiModels: (brandappId) => [
201
+ ...keys.all,
202
+ "ai",
203
+ "models",
204
+ brandappId
205
+ ],
206
+ aiAgents: (brandappId) => [
207
+ ...keys.all,
208
+ "ai",
209
+ "agents",
210
+ brandappId
211
+ ],
212
+ posts: (brandappId, query) => [
213
+ ...keys.all,
214
+ "posts",
215
+ brandappId,
216
+ query
217
+ ],
218
+ post: (postId) => [
219
+ ...keys.all,
220
+ "post",
221
+ postId
222
+ ],
223
+ postGroups: (brandappId, query) => [
224
+ ...keys.all,
225
+ "postGroups",
226
+ brandappId,
227
+ query
228
+ ],
229
+ postGroup: (groupId) => [
230
+ ...keys.all,
231
+ "postGroup",
232
+ groupId
233
+ ],
234
+ tags: (brandappId, query) => [
235
+ ...keys.all,
236
+ "tags",
237
+ brandappId,
238
+ query
239
+ ],
240
+ files: (brandappId, query) => [
241
+ ...keys.all,
242
+ "files",
243
+ brandappId,
244
+ query
245
+ ],
246
+ file: (fileId) => [
247
+ ...keys.all,
248
+ "file",
249
+ fileId
250
+ ]
124
251
  };
252
+ /**
253
+ * List every EAV entity defined for the current brandapp, including their
254
+ * attribute metadata. Cached for 5 minutes since the schema rarely changes
255
+ * within a session.
256
+ *
257
+ * @example
258
+ * ```tsx
259
+ * function EntityPicker() {
260
+ * const sdk = useContext(SdkContext);
261
+ * const { data: entities, isPending } = useEavEntities(sdk);
262
+ * if (isPending) return <Spinner />;
263
+ * return (
264
+ * <select>
265
+ * {entities?.map((e) => <option key={e.id}>{e.name}</option>)}
266
+ * </select>
267
+ * );
268
+ * }
269
+ * ```
270
+ */
125
271
  function useEavEntities(sdk, options) {
126
- return useQuery({
127
- queryKey: keys.entities(sdk.config.brandappId),
128
- queryFn: () => sdk.eav.entities.list(),
129
- staleTime: 5 * 60 * 1e3,
130
- // 5 min — schema rarely changes
131
- ...options
132
- });
272
+ return useQuery({
273
+ queryKey: keys.entities(sdk.config.brandappId),
274
+ queryFn: () => sdk.eav.entities.list(),
275
+ staleTime: 300 * 1e3,
276
+ ...options
277
+ });
133
278
  }
134
279
  function useEavEntity(sdk, entityId, options) {
135
- return useQuery({
136
- queryKey: keys.entity(entityId),
137
- queryFn: () => sdk.eav.entities.get(entityId),
138
- staleTime: 5 * 60 * 1e3,
139
- enabled: !!entityId,
140
- ...options
141
- });
280
+ return useQuery({
281
+ queryKey: keys.entity(entityId),
282
+ queryFn: () => sdk.eav.entities.get(entityId),
283
+ staleTime: 300 * 1e3,
284
+ enabled: !!entityId,
285
+ ...options
286
+ });
142
287
  }
288
+ /**
289
+ * List records for an entity with optional filters and pagination.
290
+ *
291
+ * The `query` object is part of the cache key, so changing filters will
292
+ * fetch a fresh page rather than reuse a stale one. For cursor-style
293
+ * pagination prefer `useEavRecordsInfinite`.
294
+ *
295
+ * @example
296
+ * ```tsx
297
+ * import { where } from "@reopt-ai/brandapp-sdk/eav";
298
+ *
299
+ * function ActiveContacts({ entityId }: { entityId: string }) {
300
+ * const sdk = useContext(SdkContext);
301
+ * const { data, isPending } = useEavRecords(sdk, entityId, {
302
+ * filters: [where("status").eq("active")],
303
+ * limit: 50,
304
+ * });
305
+ * if (isPending) return <Spinner />;
306
+ * return <RecordTable records={data?.records ?? []} total={data?.total} />;
307
+ * }
308
+ * ```
309
+ */
143
310
  function useEavRecords(sdk, entityId, query, options) {
144
- return useQuery({
145
- queryKey: keys.records(entityId, query),
146
- queryFn: () => sdk.eav.records.list(entityId, query),
147
- enabled: !!entityId,
148
- ...options
149
- });
311
+ return useQuery({
312
+ queryKey: keys.records(entityId, query),
313
+ queryFn: () => sdk.eav.records.list(entityId, query),
314
+ enabled: !!entityId,
315
+ ...options
316
+ });
150
317
  }
151
318
  function useEavRecordsInfinite(sdk, entityId, query, options) {
152
- return useInfiniteQuery({
153
- queryKey: keys.records(entityId, query),
154
- queryFn: ({ pageParam }) => sdk.eav.records.list(entityId, { ...query, page: pageParam }),
155
- initialPageParam: 1,
156
- getNextPageParam: (lastPage) => lastPage.page < lastPage.totalPages ? lastPage.page + 1 : void 0,
157
- enabled: !!entityId,
158
- ...options
159
- });
319
+ return useInfiniteQuery({
320
+ queryKey: keys.recordsInfinite(entityId, query),
321
+ queryFn: ({ pageParam }) => sdk.eav.records.list(entityId, {
322
+ ...query,
323
+ page: pageParam
324
+ }),
325
+ initialPageParam: 1,
326
+ getNextPageParam: (lastPage) => lastPage.page < lastPage.totalPages ? lastPage.page + 1 : void 0,
327
+ enabled: !!entityId,
328
+ ...options
329
+ });
160
330
  }
161
331
  function useEavRecord(sdk, entityId, recordId, options) {
162
- return useQuery({
163
- queryKey: keys.record(entityId, recordId),
164
- queryFn: () => sdk.eav.records.get(entityId, recordId),
165
- enabled: !!entityId && !!recordId,
166
- ...options
167
- });
332
+ return useQuery({
333
+ queryKey: keys.record(entityId, recordId),
334
+ queryFn: () => sdk.eav.records.get(entityId, recordId),
335
+ enabled: !!entityId && !!recordId,
336
+ ...options
337
+ });
168
338
  }
169
339
  function useEavRecordCount(sdk, entityId, query, options) {
170
- return useQuery({
171
- queryKey: keys.recordCount(entityId, query),
172
- queryFn: () => sdk.eav.records.count(entityId, query),
173
- enabled: !!entityId,
174
- ...options
175
- });
340
+ return useQuery({
341
+ queryKey: keys.recordCount(entityId, query),
342
+ queryFn: () => sdk.eav.records.count(entityId, query),
343
+ enabled: !!entityId,
344
+ ...options
345
+ });
176
346
  }
347
+ /**
348
+ * Create a single record. Automatically invalidates the records list and
349
+ * count caches for this entity on success.
350
+ *
351
+ * @example
352
+ * ```tsx
353
+ * function NewContactForm({ entityId }: { entityId: string }) {
354
+ * const sdk = useContext(SdkContext);
355
+ * const create = useCreateRecord(sdk, entityId);
356
+ *
357
+ * return (
358
+ * <form
359
+ * onSubmit={async (e) => {
360
+ * e.preventDefault();
361
+ * const data = new FormData(e.currentTarget);
362
+ * await create.mutateAsync({
363
+ * values: {
364
+ * name: data.get("name") as string,
365
+ * email: data.get("email") as string,
366
+ * },
367
+ * });
368
+ * }}
369
+ * >
370
+ * <input name="name" />
371
+ * <input name="email" type="email" />
372
+ * <button disabled={create.isPending}>Save</button>
373
+ * {create.error ? <ErrorBanner error={create.error} /> : null}
374
+ * </form>
375
+ * );
376
+ * }
377
+ * ```
378
+ */
177
379
  function useCreateRecord(sdk, entityId, options) {
178
- const queryClient = useQueryClient();
179
- return useMutation({
180
- mutationFn: (input) => sdk.eav.records.create(entityId, input),
181
- onSuccess: () => {
182
- queryClient.invalidateQueries({ queryKey: keys.records(entityId) });
183
- queryClient.invalidateQueries({ queryKey: keys.recordCount(entityId) });
184
- },
185
- ...options
186
- });
380
+ const queryClient = useQueryClient();
381
+ return useMutation({
382
+ mutationFn: (input) => sdk.eav.records.create(entityId, input),
383
+ onSuccess: () => {
384
+ queryClient.invalidateQueries({ queryKey: keys.recordsPrefix(entityId) });
385
+ queryClient.invalidateQueries({ queryKey: keys.recordsInfinitePrefix(entityId) });
386
+ queryClient.invalidateQueries({ queryKey: keys.recordCountPrefix(entityId) });
387
+ },
388
+ ...options
389
+ });
187
390
  }
188
391
  function useUpdateRecord(sdk, entityId, options) {
189
- const queryClient = useQueryClient();
190
- return useMutation({
191
- mutationFn: ({
192
- recordId,
193
- input
194
- }) => sdk.eav.records.update(entityId, recordId, input),
195
- onSuccess: (_, variables) => {
196
- queryClient.invalidateQueries({ queryKey: keys.records(entityId) });
197
- queryClient.invalidateQueries({
198
- queryKey: keys.record(entityId, variables.recordId)
199
- });
200
- },
201
- ...options
202
- });
392
+ const queryClient = useQueryClient();
393
+ return useMutation({
394
+ mutationFn: ({ recordId, input }) => sdk.eav.records.update(entityId, recordId, input),
395
+ onSuccess: (_, variables) => {
396
+ queryClient.invalidateQueries({ queryKey: keys.recordsPrefix(entityId) });
397
+ queryClient.invalidateQueries({ queryKey: keys.recordsInfinitePrefix(entityId) });
398
+ queryClient.invalidateQueries({ queryKey: keys.record(entityId, variables.recordId) });
399
+ },
400
+ ...options
401
+ });
203
402
  }
403
+ /**
404
+ * Delete a record by id. Pass the recordId directly to `mutateAsync`.
405
+ *
406
+ * @example
407
+ * ```tsx
408
+ * const remove = useDeleteRecord(sdk, entityId);
409
+ * <button onClick={() => remove.mutate(record.id)}>Delete</button>
410
+ * ```
411
+ */
204
412
  function useDeleteRecord(sdk, entityId, options) {
205
- const queryClient = useQueryClient();
206
- return useMutation({
207
- mutationFn: (recordId) => sdk.eav.records.delete(entityId, recordId),
208
- onSuccess: () => {
209
- queryClient.invalidateQueries({ queryKey: keys.records(entityId) });
210
- queryClient.invalidateQueries({ queryKey: keys.recordCount(entityId) });
211
- },
212
- ...options
213
- });
413
+ const queryClient = useQueryClient();
414
+ return useMutation({
415
+ mutationFn: (recordId) => sdk.eav.records.delete(entityId, recordId),
416
+ onSuccess: () => {
417
+ queryClient.invalidateQueries({ queryKey: keys.recordsPrefix(entityId) });
418
+ queryClient.invalidateQueries({ queryKey: keys.recordsInfinitePrefix(entityId) });
419
+ queryClient.invalidateQueries({ queryKey: keys.recordCountPrefix(entityId) });
420
+ },
421
+ ...options
422
+ });
214
423
  }
424
+ /**
425
+ * 레코드 upsert mutation. 필터에 매칭되는 레코드가 있으면 업데이트, 없으면 생성.
426
+ *
427
+ * @example
428
+ * ```tsx
429
+ * const upsert = useUpsertRecord(sdk, entityId);
430
+ * await upsert.mutateAsync({
431
+ * filters: [{ attributeId: attrs.key, operator: "eq", value: "theme" }],
432
+ * values: { [attrs.key]: "theme", [attrs.value]: "dark" },
433
+ * });
434
+ * ```
435
+ */
215
436
  function useUpsertRecord(sdk, entityId, options) {
216
- const queryClient = useQueryClient();
217
- return useMutation({
218
- mutationFn: (input) => sdk.eav.records.upsert(entityId, input),
219
- onSuccess: () => {
220
- queryClient.invalidateQueries({ queryKey: keys.records(entityId) });
221
- queryClient.invalidateQueries({ queryKey: keys.recordCount(entityId) });
222
- },
223
- ...options
224
- });
437
+ const queryClient = useQueryClient();
438
+ return useMutation({
439
+ mutationFn: (input) => sdk.eav.records.upsert(entityId, input),
440
+ onSuccess: () => {
441
+ queryClient.invalidateQueries({ queryKey: keys.recordsPrefix(entityId) });
442
+ queryClient.invalidateQueries({ queryKey: keys.recordsInfinitePrefix(entityId) });
443
+ queryClient.invalidateQueries({ queryKey: keys.recordCountPrefix(entityId) });
444
+ },
445
+ ...options
446
+ });
225
447
  }
448
+ /**
449
+ * 최대 100개 레코드를 한 번에 생성하는 mutation.
450
+ *
451
+ * @example
452
+ * ```tsx
453
+ * const bulkCreate = useBulkCreateRecords(sdk, entityId);
454
+ * await bulkCreate.mutateAsync([
455
+ * { values: { name: "Alice" } },
456
+ * { values: { name: "Bob" } },
457
+ * ]);
458
+ * ```
459
+ */
226
460
  function useBulkCreateRecords(sdk, entityId, options) {
227
- const queryClient = useQueryClient();
228
- return useMutation({
229
- mutationFn: (records) => sdk.eav.records.bulkCreate(entityId, records),
230
- onSuccess: () => {
231
- queryClient.invalidateQueries({ queryKey: keys.records(entityId) });
232
- queryClient.invalidateQueries({ queryKey: keys.recordCount(entityId) });
233
- },
234
- ...options
235
- });
461
+ const queryClient = useQueryClient();
462
+ return useMutation({
463
+ mutationFn: (records) => sdk.eav.records.bulkCreate(entityId, records),
464
+ onSuccess: () => {
465
+ queryClient.invalidateQueries({ queryKey: keys.recordsPrefix(entityId) });
466
+ queryClient.invalidateQueries({ queryKey: keys.recordsInfinitePrefix(entityId) });
467
+ queryClient.invalidateQueries({ queryKey: keys.recordCountPrefix(entityId) });
468
+ },
469
+ ...options
470
+ });
236
471
  }
472
+ /**
473
+ * 최대 100개 레코드를 한 번에 업데이트하는 mutation.
474
+ */
237
475
  function useBulkUpdateRecords(sdk, entityId, options) {
238
- const queryClient = useQueryClient();
239
- return useMutation({
240
- mutationFn: (updates) => sdk.eav.records.bulkUpdate(entityId, updates),
241
- onSuccess: (_data, variables) => {
242
- queryClient.invalidateQueries({ queryKey: keys.records(entityId) });
243
- for (const { id } of variables) {
244
- queryClient.invalidateQueries({
245
- queryKey: keys.record(entityId, id)
246
- });
247
- }
248
- },
249
- ...options
250
- });
476
+ const queryClient = useQueryClient();
477
+ return useMutation({
478
+ mutationFn: (updates) => sdk.eav.records.bulkUpdate(entityId, updates),
479
+ onSuccess: (_data, variables) => {
480
+ queryClient.invalidateQueries({ queryKey: keys.recordsPrefix(entityId) });
481
+ queryClient.invalidateQueries({ queryKey: keys.recordsInfinitePrefix(entityId) });
482
+ for (const { id } of variables) queryClient.invalidateQueries({ queryKey: keys.record(entityId, id) });
483
+ },
484
+ ...options
485
+ });
251
486
  }
487
+ /**
488
+ * 최대 100개 레코드를 한 번에 삭제하는 mutation. 삭제된 레코드 수를 반환.
489
+ */
252
490
  function useBulkDeleteRecords(sdk, entityId, options) {
253
- const queryClient = useQueryClient();
254
- return useMutation({
255
- mutationFn: (ids) => sdk.eav.records.bulkDelete(entityId, ids),
256
- onSuccess: () => {
257
- queryClient.invalidateQueries({ queryKey: keys.records(entityId) });
258
- queryClient.invalidateQueries({ queryKey: keys.recordCount(entityId) });
259
- },
260
- ...options
261
- });
491
+ const queryClient = useQueryClient();
492
+ return useMutation({
493
+ mutationFn: (ids) => sdk.eav.records.bulkDelete(entityId, ids),
494
+ onSuccess: () => {
495
+ queryClient.invalidateQueries({ queryKey: keys.recordsPrefix(entityId) });
496
+ queryClient.invalidateQueries({ queryKey: keys.recordsInfinitePrefix(entityId) });
497
+ queryClient.invalidateQueries({ queryKey: keys.recordCountPrefix(entityId) });
498
+ },
499
+ ...options
500
+ });
262
501
  }
502
+ /**
503
+ * 필터에 매칭되는 모든 레코드를 삭제하는 mutation. 삭제된 수를 반환.
504
+ */
263
505
  function useDeleteRecordsWhere(sdk, entityId, options) {
264
- const queryClient = useQueryClient();
265
- return useMutation({
266
- mutationFn: (input) => sdk.eav.records.deleteWhere(entityId, input),
267
- onSuccess: () => {
268
- queryClient.invalidateQueries({ queryKey: keys.records(entityId) });
269
- queryClient.invalidateQueries({ queryKey: keys.recordCount(entityId) });
270
- },
271
- ...options
272
- });
506
+ const queryClient = useQueryClient();
507
+ return useMutation({
508
+ mutationFn: (input) => sdk.eav.records.deleteWhere(entityId, input),
509
+ onSuccess: () => {
510
+ queryClient.invalidateQueries({ queryKey: keys.recordsPrefix(entityId) });
511
+ queryClient.invalidateQueries({ queryKey: keys.recordsInfinitePrefix(entityId) });
512
+ queryClient.invalidateQueries({ queryKey: keys.recordCountPrefix(entityId) });
513
+ },
514
+ ...options
515
+ });
273
516
  }
517
+ /**
518
+ * BrandApp AI 크레딧 잔액 조회
519
+ *
520
+ * @example
521
+ * ```tsx
522
+ * const { data: credits } = useAiCredits(sdk);
523
+ * // credits?.balance, credits?.limit, credits?.status
524
+ * ```
525
+ */
274
526
  function useAiCredits(sdk, options) {
275
- return useQuery({
276
- queryKey: keys.aiCredits(sdk.config.brandappId),
277
- queryFn: () => sdk.ai.credits(),
278
- staleTime: 30 * 1e3,
279
- // 30초 — 크레딧은 자주 변동
280
- ...options
281
- });
527
+ return useQuery({
528
+ queryKey: keys.aiCredits(sdk.config.brandappId),
529
+ queryFn: () => sdk.ai.credits(),
530
+ staleTime: 30 * 1e3,
531
+ ...options
532
+ });
282
533
  }
534
+ /**
535
+ * BrandApp AI 사용 가능 모델 목록
536
+ *
537
+ * @example
538
+ * ```tsx
539
+ * const { data: models } = useAiModels(sdk);
540
+ * // models?.map(m => m.id)
541
+ * ```
542
+ */
283
543
  function useAiModels(sdk, options) {
284
- return useQuery({
285
- queryKey: keys.aiModels(sdk.config.brandappId),
286
- queryFn: () => sdk.ai.models(),
287
- staleTime: 5 * 60 * 1e3,
288
- // 5분 — 모델 목록은 자주 안 바뀜
289
- ...options
290
- });
544
+ return useQuery({
545
+ queryKey: keys.aiModels(sdk.config.brandappId),
546
+ queryFn: () => sdk.ai.models(),
547
+ staleTime: 300 * 1e3,
548
+ ...options
549
+ });
291
550
  }
551
+ /**
552
+ * BrandApp에서 사용 가능한 커스텀 에이전트 목록
553
+ *
554
+ * @example
555
+ * ```tsx
556
+ * const { data: agents } = useAiAgents(sdk);
557
+ * // agents?.map(a => ({ id: a.id, name: a.name, defaultModel: a.defaultModel }))
558
+ * ```
559
+ */
292
560
  function useAiAgents(sdk, options) {
293
- return useQuery({
294
- queryKey: keys.aiAgents(sdk.config.brandappId),
295
- queryFn: () => sdk.ai.agents(),
296
- staleTime: 5 * 60 * 1e3,
297
- // 5분 — 에이전트 목록은 자주 안 바뀜
298
- ...options
299
- });
561
+ return useQuery({
562
+ queryKey: keys.aiAgents(sdk.config.brandappId),
563
+ queryFn: () => sdk.ai.agents(),
564
+ staleTime: 300 * 1e3,
565
+ ...options
566
+ });
300
567
  }
568
+ /**
569
+ * AI 텍스트 생성 (non-streaming) mutation
570
+ *
571
+ * @example
572
+ * ```tsx
573
+ * const completion = useAiCompletion(sdk);
574
+ *
575
+ * const handleSubmit = () => {
576
+ * completion.mutate({
577
+ * messages: [{ role: "user", content: "안녕하세요" }],
578
+ * model: "anthropic/claude-haiku-4.5",
579
+ * });
580
+ * };
581
+ * // completion.data?.message.content
582
+ * ```
583
+ */
301
584
  function useAiCompletion(sdk, options) {
302
- const queryClient = useQueryClient();
303
- return useMutation({
304
- mutationFn: (input) => sdk.ai.complete(input),
305
- ...options,
306
- // 크레딧이 차감됐으므로 잔액 쿼리를 무효화(배지 즉시 갱신). caller onSuccess 병합.
307
- onSuccess: (...args) => {
308
- queryClient.invalidateQueries({
309
- queryKey: keys.aiCredits(sdk.config.brandappId)
310
- });
311
- return options?.onSuccess?.(...args);
312
- }
313
- });
585
+ const queryClient = useQueryClient();
586
+ return useMutation({
587
+ mutationFn: (input) => sdk.ai.complete(input),
588
+ ...options,
589
+ onSuccess: (...args) => {
590
+ queryClient.invalidateQueries({ queryKey: keys.aiCredits(sdk.config.brandappId) });
591
+ return options?.onSuccess?.(...args);
592
+ }
593
+ });
314
594
  }
595
+ /**
596
+ * AI 이미지 생성 mutation
597
+ *
598
+ * @example
599
+ * ```tsx
600
+ * const imageGen = useAiImageGenerate(sdk);
601
+ *
602
+ * const handleGenerate = () => {
603
+ * imageGen.mutate({
604
+ * prompt: "브랜드 배너 이미지",
605
+ * style: "minimalist",
606
+ * aspectRatio: "16:9",
607
+ * });
608
+ * };
609
+ * // imageGen.data?.url
610
+ * ```
611
+ */
315
612
  function useAiImageGenerate(sdk, options) {
316
- const queryClient = useQueryClient();
317
- return useMutation({
318
- mutationFn: (input) => sdk.ai.generateImage(input),
319
- ...options,
320
- onSuccess: (...args) => {
321
- queryClient.invalidateQueries({
322
- queryKey: keys.aiCredits(sdk.config.brandappId)
323
- });
324
- return options?.onSuccess?.(...args);
325
- }
326
- });
613
+ const queryClient = useQueryClient();
614
+ return useMutation({
615
+ mutationFn: (input) => sdk.ai.generateImage(input),
616
+ ...options,
617
+ onSuccess: (...args) => {
618
+ queryClient.invalidateQueries({ queryKey: keys.aiCredits(sdk.config.brandappId) });
619
+ return options?.onSuccess?.(...args);
620
+ }
621
+ });
327
622
  }
623
+ /**
624
+ * Post 목록 조회
625
+ *
626
+ * @example
627
+ * ```tsx
628
+ * const { data } = usePostList(sdk, { status: "published", limit: 10 });
629
+ * // data?.records (Post[]), data?.total
630
+ * ```
631
+ */
328
632
  function usePostList(sdk, query, options) {
329
- return useQuery({
330
- queryKey: keys.posts(sdk.config.brandappId, query),
331
- queryFn: () => sdk.cms.posts.list(query),
332
- ...options
333
- });
633
+ return useQuery({
634
+ queryKey: keys.posts(sdk.config.brandappId, query),
635
+ queryFn: () => sdk.cms.posts.list(query),
636
+ ...options
637
+ });
334
638
  }
639
+ /**
640
+ * 단일 Post 조회 (with document content)
641
+ *
642
+ * @example
643
+ * ```tsx
644
+ * const { data: post } = usePost(sdk, postId);
645
+ * // post?.title, post?.document.contentRich
646
+ * ```
647
+ */
335
648
  function usePost(sdk, postId, options) {
336
- return useQuery({
337
- queryKey: keys.post(postId),
338
- queryFn: () => sdk.cms.posts.get(postId),
339
- enabled: !!postId,
340
- ...options
341
- });
649
+ return useQuery({
650
+ queryKey: keys.post(postId),
651
+ queryFn: () => sdk.cms.posts.get(postId),
652
+ enabled: !!postId,
653
+ ...options
654
+ });
342
655
  }
656
+ /**
657
+ * PostGroup 목록 조회
658
+ *
659
+ * @example
660
+ * ```tsx
661
+ * const { data } = usePostGroupList(sdk, { sortBy: "name" });
662
+ * // data?.records (PostGroup[]), data?.total
663
+ * ```
664
+ */
343
665
  function usePostGroupList(sdk, query, options) {
344
- return useQuery({
345
- queryKey: keys.postGroups(sdk.config.brandappId, query),
346
- queryFn: () => sdk.cms.postGroups.list(query),
347
- ...options
348
- });
666
+ return useQuery({
667
+ queryKey: keys.postGroups(sdk.config.brandappId, query),
668
+ queryFn: () => sdk.cms.postGroups.list(query),
669
+ ...options
670
+ });
349
671
  }
672
+ /**
673
+ * 단일 PostGroup 조회
674
+ *
675
+ * @example
676
+ * ```tsx
677
+ * const { data: group } = usePostGroup(sdk, groupId);
678
+ * // group?.name, group?.postCount
679
+ * ```
680
+ */
350
681
  function usePostGroup(sdk, groupId, options) {
351
- return useQuery({
352
- queryKey: keys.postGroup(groupId),
353
- queryFn: () => sdk.cms.postGroups.get(groupId),
354
- enabled: !!groupId,
355
- ...options
356
- });
682
+ return useQuery({
683
+ queryKey: keys.postGroup(groupId),
684
+ queryFn: () => sdk.cms.postGroups.get(groupId),
685
+ enabled: !!groupId,
686
+ ...options
687
+ });
357
688
  }
689
+ /**
690
+ * Slug 기반 단일 Post 조회. 외부 사이트의 `/blog/[slug]` 같은 라우트에서
691
+ * id 매핑 없이 사용. (서버 컴포넌트에서는 `sdk.cms.posts.getBySlug`를
692
+ * 직접 호출하는 편이 추가 hop을 피할 수 있다.)
693
+ *
694
+ * @example
695
+ * ```tsx
696
+ * const { data: post } = usePostBySlug(sdk, slug);
697
+ * ```
698
+ */
358
699
  function usePostBySlug(sdk, slug, opts, options) {
359
- return useQuery({
360
- queryKey: [
361
- ...keys.all,
362
- "postBySlug",
363
- sdk.config.brandappId,
364
- slug,
365
- opts
366
- ],
367
- queryFn: () => sdk.cms.posts.getBySlug(slug, opts),
368
- enabled: !!slug,
369
- ...options
370
- });
700
+ return useQuery({
701
+ queryKey: [
702
+ ...keys.all,
703
+ "postBySlug",
704
+ sdk.config.brandappId,
705
+ slug,
706
+ opts
707
+ ],
708
+ queryFn: () => sdk.cms.posts.getBySlug(slug, opts),
709
+ enabled: !!slug,
710
+ ...options
711
+ });
371
712
  }
713
+ /**
714
+ * Brand 범위에서 사용된 포스트 태그 목록.
715
+ *
716
+ * @example
717
+ * ```tsx
718
+ * const { data: tags } = useCmsTags(sdk, { groupId: blogId });
719
+ * // tags?.[0]: { id, text, postCount }
720
+ * ```
721
+ */
372
722
  function useCmsTags(sdk, query, options) {
373
- return useQuery({
374
- queryKey: keys.tags(sdk.config.brandappId, query),
375
- queryFn: () => sdk.cms.tags.list(query),
376
- ...options
377
- });
723
+ return useQuery({
724
+ queryKey: keys.tags(sdk.config.brandappId, query),
725
+ queryFn: () => sdk.cms.tags.list(query),
726
+ ...options
727
+ });
378
728
  }
729
+ /**
730
+ * 파일 목록 조회
731
+ *
732
+ * @example
733
+ * ```tsx
734
+ * const { data } = useFiles(sdk, { contentType: "image/*", sortBy: "createdAt" });
735
+ * // data?.data (FileInfo[]), data?.meta
736
+ * ```
737
+ */
379
738
  function useFiles(sdk, query, options) {
380
- return useQuery({
381
- queryKey: keys.files(sdk.config.brandappId, query),
382
- queryFn: () => sdk.files.list(query),
383
- ...options
384
- });
739
+ return useQuery({
740
+ queryKey: keys.files(sdk.config.brandappId, query),
741
+ queryFn: () => sdk.files.list(query),
742
+ ...options
743
+ });
385
744
  }
745
+ /**
746
+ * 단일 파일 조회
747
+ *
748
+ * @example
749
+ * ```tsx
750
+ * const { data: file } = useFile(sdk, fileId);
751
+ * // file?.name, file?.url
752
+ * ```
753
+ */
386
754
  function useFile(sdk, fileId, options) {
387
- return useQuery({
388
- queryKey: keys.file(fileId),
389
- queryFn: () => sdk.files.get(fileId),
390
- enabled: !!fileId,
391
- ...options
392
- });
755
+ return useQuery({
756
+ queryKey: keys.file(fileId),
757
+ queryFn: () => sdk.files.get(fileId),
758
+ enabled: !!fileId,
759
+ ...options
760
+ });
393
761
  }
762
+ /**
763
+ * 파일 삭제 mutation
764
+ *
765
+ * @example
766
+ * ```tsx
767
+ * const deleteFile = useDeleteFile(sdk);
768
+ * await deleteFile.mutateAsync("file-uuid");
769
+ * ```
770
+ */
394
771
  function useDeleteFile(sdk, options) {
395
- const queryClient = useQueryClient();
396
- return useMutation({
397
- mutationFn: (fileId) => sdk.files.delete(fileId),
398
- onSuccess: () => {
399
- queryClient.invalidateQueries({
400
- queryKey: keys.files(sdk.config.brandappId)
401
- });
402
- },
403
- ...options
404
- });
772
+ const queryClient = useQueryClient();
773
+ return useMutation({
774
+ mutationFn: (fileId) => sdk.files.delete(fileId),
775
+ onSuccess: () => {
776
+ queryClient.invalidateQueries({ queryKey: keys.files(sdk.config.brandappId) });
777
+ },
778
+ ...options
779
+ });
405
780
  }
781
+ /**
782
+ * 파일 업로드 mutation
783
+ *
784
+ * @example
785
+ * ```tsx
786
+ * const upload = useUploadFile(sdk);
787
+ * const file = await upload.mutateAsync({
788
+ * file: blob,
789
+ * options: { name: "banner.png" },
790
+ * });
791
+ * console.log(file.url);
792
+ * ```
793
+ */
406
794
  function useUploadFile(sdk, options) {
407
- const queryClient = useQueryClient();
408
- return useMutation({
409
- mutationFn: (input) => sdk.files.upload(input.file, input.options),
410
- onSuccess: () => {
411
- queryClient.invalidateQueries({
412
- queryKey: keys.files(sdk.config.brandappId)
413
- });
414
- },
415
- ...options
416
- });
795
+ const queryClient = useQueryClient();
796
+ return useMutation({
797
+ mutationFn: (input) => sdk.files.upload(input.file, input.options),
798
+ onSuccess: () => {
799
+ queryClient.invalidateQueries({ queryKey: keys.files(sdk.config.brandappId) });
800
+ },
801
+ ...options
802
+ });
417
803
  }
418
804
 
805
+ //#endregion
419
806
  export { keys as reoptQueryKeys, useAiAgents, useAiCompletion, useAiCredits, useAiImageGenerate, useAiModels, useAiStream, useBulkCreateRecords, useBulkDeleteRecords, useBulkUpdateRecords, useCmsTags, useCreateRecord, useDeleteFile, useDeleteRecord, useDeleteRecordsWhere, useEavEntities, useEavEntity, useEavRecord, useEavRecordCount, useEavRecords, useEavRecordsInfinite, useFile, useFiles, usePost, usePostBySlug, usePostGroup, usePostGroupList, usePostList, useUpdateRecord, useUploadFile, useUpsertRecord };
420
- //# sourceMappingURL=hooks.js.map
421
807
  //# sourceMappingURL=hooks.js.map