@reopt-ai/brandapp-sdk 3.0.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/CHANGELOG.md +574 -0
- package/LICENSE +21 -0
- package/README.md +468 -0
- package/dist/ai/index.d.ts +314 -0
- package/dist/ai/index.js +7 -0
- package/dist/ai-provider/index.d.ts +196 -0
- package/dist/ai-provider/index.js +703 -0
- package/dist/auth/index.d.ts +76 -0
- package/dist/auth/index.js +40 -0
- package/dist/better-auth/client.d.ts +29 -0
- package/dist/better-auth/client.js +10 -0
- package/dist/better-auth/index.d.ts +82 -0
- package/dist/better-auth/index.js +145 -0
- package/dist/chunk-6FLYVNZI.js +32 -0
- package/dist/chunk-6KPKZ7ZB.js +49 -0
- package/dist/chunk-DI6QJPTQ.js +449 -0
- package/dist/chunk-E457LO5A.js +599 -0
- package/dist/chunk-F7BXBTZI.js +54 -0
- package/dist/chunk-J5Y2GSJF.js +443 -0
- package/dist/chunk-K3YVJE6E.js +96 -0
- package/dist/chunk-KU2LN5SE.js +350 -0
- package/dist/chunk-L4DHB36G.js +75 -0
- package/dist/chunk-PJZB4VP7.js +63 -0
- package/dist/chunk-REIKXSMY.js +7 -0
- package/dist/chunk-T2WXHAAC.js +54 -0
- package/dist/chunk-TUKIYH4Q.js +112 -0
- package/dist/chunk-WSEROZVO.js +81 -0
- package/dist/chunk-YRGLBM6V.js +157 -0
- package/dist/client-BkcO-0C2.d.ts +216 -0
- package/dist/client-CN5_tNOC.d.ts +147 -0
- package/dist/client-DttyeM_h.d.ts +102 -0
- package/dist/cms/index.d.ts +137 -0
- package/dist/cms/index.js +101 -0
- package/dist/config-CtxyJsDR.d.ts +397 -0
- package/dist/dev/index.d.ts +509 -0
- package/dist/dev/index.js +3071 -0
- package/dist/eav/coerce.d.ts +42 -0
- package/dist/eav/coerce.js +65 -0
- package/dist/eav/index.d.ts +214 -0
- package/dist/eav/index.js +147 -0
- package/dist/eav/migrate.d.ts +236 -0
- package/dist/eav/migrate.js +219 -0
- package/dist/eav/schema.d.ts +260 -0
- package/dist/eav/schema.js +656 -0
- package/dist/errors-5hd5ZR-M.d.ts +158 -0
- package/dist/feedback/index.d.ts +132 -0
- package/dist/feedback/index.js +5 -0
- package/dist/files/index.d.ts +54 -0
- package/dist/files/index.js +31 -0
- package/dist/index.d.ts +221 -0
- package/dist/index.js +84 -0
- package/dist/plans/index.d.ts +140 -0
- package/dist/plans/index.js +5 -0
- package/dist/push/index.d.ts +79 -0
- package/dist/push/index.js +5 -0
- package/dist/react/hooks.d.ts +376 -0
- package/dist/react/hooks.js +421 -0
- package/dist/terms/index.d.ts +79 -0
- package/dist/terms/index.js +5 -0
- package/dist/testing/index.d.ts +154 -0
- package/dist/testing/index.js +81 -0
- package/dist/typed-client-BxOVIiMU.d.ts +40 -0
- package/dist/types-6E3ZLL9X.d.ts +24 -0
- package/dist/types-DskYLVb8.d.ts +104 -0
- package/dist/types-ckmDDW3N.d.ts +129 -0
- package/dist/webhooks/index.d.ts +140 -0
- package/dist/webhooks/index.js +142 -0
- package/docs/api-reference.md +557 -0
- package/docs/cms.md +318 -0
- package/docs/dev-server.md +164 -0
- package/docs/environment.md +211 -0
- package/docs/errors.md +290 -0
- package/docs/files.md +272 -0
- package/docs/migration.md +315 -0
- package/docs/testing.md +163 -0
- package/package.json +173 -0
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import * as _tanstack_react_query from '@tanstack/react-query';
|
|
2
|
+
import { UseQueryOptions, UseMutationOptions, UseInfiniteQueryOptions } from '@tanstack/react-query';
|
|
3
|
+
import { ReoptSDK } from '../index.js';
|
|
4
|
+
import { StreamDoneData, CompletionOptions, AgentInfo, CompletionResult, CreditInfo, ImageGenerateResult, ImageGenerateOptions, ModelInfo } from '../ai/index.js';
|
|
5
|
+
import { g as ReoptSDKError } from '../errors-5hd5ZR-M.js';
|
|
6
|
+
import { L as ListRecordsQuery, m as EavRecord, g as CreateRecordInput, d as BulkUpdateItem, i as DeleteWhereInput, l as EavEntity, P as PaginatedResponse, s as UpdateRecordInput, u as UpsertRecordResult, t as UpsertRecordInput } from '../config-CtxyJsDR.js';
|
|
7
|
+
import { a as ListPostsQuery, L as ListPostGroupsQuery, b as ListTagsQuery, T as Tag, c as PostDetail, d as PostGroup, C as CmsPaginatedResponse, P as Post } from '../types-ckmDDW3N.js';
|
|
8
|
+
import { a as FileListQuery, F as FileInfo, b as FileListResponse, U as UploadOptions } from '../client-CN5_tNOC.js';
|
|
9
|
+
import '../terms/index.js';
|
|
10
|
+
import '../types-DskYLVb8.js';
|
|
11
|
+
import '../push/index.js';
|
|
12
|
+
import '../plans/index.js';
|
|
13
|
+
import '../feedback/index.js';
|
|
14
|
+
import '../client-DttyeM_h.js';
|
|
15
|
+
import '../typed-client-BxOVIiMU.js';
|
|
16
|
+
|
|
17
|
+
type UseAiStreamOptions = {
|
|
18
|
+
/** Called on each new chunk appended to text */
|
|
19
|
+
onChunk?: (chunk: string) => void;
|
|
20
|
+
/** Called when the stream completes successfully */
|
|
21
|
+
onFinish?: (text: string, metadata: StreamDoneData | null) => void;
|
|
22
|
+
/** Called when the stream errors */
|
|
23
|
+
onError?: (error: Error) => void;
|
|
24
|
+
};
|
|
25
|
+
type UseAiStreamReturn = {
|
|
26
|
+
/** Accumulated text from the current/last generation */
|
|
27
|
+
text: string;
|
|
28
|
+
/** Whether a stream is currently in progress */
|
|
29
|
+
isStreaming: boolean;
|
|
30
|
+
/** Error from the most recent generation attempt, or null */
|
|
31
|
+
error: Error | null;
|
|
32
|
+
/** Metadata (usage, credits) from the last completed stream */
|
|
33
|
+
metadata: StreamDoneData | null;
|
|
34
|
+
/** Start a new generation. Aborts any in-progress stream first. */
|
|
35
|
+
generate: (options: Omit<CompletionOptions, "signal">) => void;
|
|
36
|
+
/** Abort the current stream */
|
|
37
|
+
stop: () => void;
|
|
38
|
+
/** Reset text, error, and metadata to initial state */
|
|
39
|
+
reset: () => void;
|
|
40
|
+
};
|
|
41
|
+
declare function useAiStream(sdk: ReoptSDK, options?: UseAiStreamOptions): UseAiStreamReturn;
|
|
42
|
+
|
|
43
|
+
declare const keys: {
|
|
44
|
+
all: readonly ["reopt"];
|
|
45
|
+
entities: (brandappId?: string) => readonly ["reopt", "entities", string | undefined];
|
|
46
|
+
entity: (entityId: string) => readonly ["reopt", "entity", string];
|
|
47
|
+
records: (entityId: string, query?: ListRecordsQuery) => readonly ["reopt", "records", string, ListRecordsQuery | undefined];
|
|
48
|
+
record: (entityId: string, recordId: string) => readonly ["reopt", "record", string, string];
|
|
49
|
+
recordCount: (entityId: string, query?: Pick<ListRecordsQuery, "filters" | "authUserId">) => readonly ["reopt", "recordCount", string, Pick<ListRecordsQuery, "filters" | "authUserId"> | undefined];
|
|
50
|
+
aiCredits: (brandappId?: string) => readonly ["reopt", "ai", "credits", string | undefined];
|
|
51
|
+
aiModels: (brandappId?: string) => readonly ["reopt", "ai", "models", string | undefined];
|
|
52
|
+
aiAgents: (brandappId?: string) => readonly ["reopt", "ai", "agents", string | undefined];
|
|
53
|
+
posts: (brandappId?: string, query?: ListPostsQuery) => readonly ["reopt", "posts", string | undefined, ListPostsQuery | undefined];
|
|
54
|
+
post: (postId: string) => readonly ["reopt", "post", string];
|
|
55
|
+
postGroups: (brandappId?: string, query?: ListPostGroupsQuery) => readonly ["reopt", "postGroups", string | undefined, ListPostGroupsQuery | undefined];
|
|
56
|
+
postGroup: (groupId: string) => readonly ["reopt", "postGroup", string];
|
|
57
|
+
tags: (brandappId?: string, query?: ListTagsQuery) => readonly ["reopt", "tags", string | undefined, ListTagsQuery | undefined];
|
|
58
|
+
files: (brandappId?: string, query?: FileListQuery) => readonly ["reopt", "files", string | undefined, FileListQuery | undefined];
|
|
59
|
+
file: (fileId: string) => readonly ["reopt", "file", string];
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* List every EAV entity defined for the current brandapp, including their
|
|
64
|
+
* attribute metadata. Cached for 5 minutes since the schema rarely changes
|
|
65
|
+
* within a session.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```tsx
|
|
69
|
+
* function EntityPicker() {
|
|
70
|
+
* const sdk = useContext(SdkContext);
|
|
71
|
+
* const { data: entities, isPending } = useEavEntities(sdk);
|
|
72
|
+
* if (isPending) return <Spinner />;
|
|
73
|
+
* return (
|
|
74
|
+
* <select>
|
|
75
|
+
* {entities?.map((e) => <option key={e.id}>{e.name}</option>)}
|
|
76
|
+
* </select>
|
|
77
|
+
* );
|
|
78
|
+
* }
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
declare function useEavEntities(sdk: ReoptSDK, options?: Omit<UseQueryOptions<EavEntity[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<NoInfer<EavEntity[]>, Error>;
|
|
82
|
+
declare function useEavEntity(sdk: ReoptSDK, entityId: string, options?: Omit<UseQueryOptions, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<unknown, Error>;
|
|
83
|
+
/**
|
|
84
|
+
* List records for an entity with optional filters and pagination.
|
|
85
|
+
*
|
|
86
|
+
* The `query` object is part of the cache key, so changing filters will
|
|
87
|
+
* fetch a fresh page rather than reuse a stale one. For cursor-style
|
|
88
|
+
* pagination prefer `useEavRecordsInfinite`.
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```tsx
|
|
92
|
+
* import { where } from "@reopt-ai/brandapp-sdk/eav";
|
|
93
|
+
*
|
|
94
|
+
* function ActiveContacts({ entityId }: { entityId: string }) {
|
|
95
|
+
* const sdk = useContext(SdkContext);
|
|
96
|
+
* const { data, isPending } = useEavRecords(sdk, entityId, {
|
|
97
|
+
* filters: [where("status").eq("active")],
|
|
98
|
+
* limit: 50,
|
|
99
|
+
* });
|
|
100
|
+
* if (isPending) return <Spinner />;
|
|
101
|
+
* return <RecordTable records={data?.records ?? []} total={data?.total} />;
|
|
102
|
+
* }
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
declare function useEavRecords(sdk: ReoptSDK, entityId: string, query?: ListRecordsQuery, options?: Omit<UseQueryOptions<PaginatedResponse<EavRecord>>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<NoInfer<PaginatedResponse<EavRecord>>, Error>;
|
|
106
|
+
declare function useEavRecordsInfinite(sdk: ReoptSDK, entityId: string, query?: Omit<ListRecordsQuery, "page">, options?: Omit<UseInfiniteQueryOptions<PaginatedResponse<EavRecord>>, "queryKey" | "queryFn" | "getNextPageParam" | "initialPageParam">): _tanstack_react_query.UseInfiniteQueryResult<PaginatedResponse<EavRecord>, Error>;
|
|
107
|
+
declare function useEavRecord(sdk: ReoptSDK, entityId: string, recordId: string, options?: Omit<UseQueryOptions, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<unknown, Error>;
|
|
108
|
+
declare function useEavRecordCount(sdk: ReoptSDK, entityId: string, query?: Pick<ListRecordsQuery, "filters" | "authUserId">, options?: Omit<UseQueryOptions<number>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<number, Error>;
|
|
109
|
+
/**
|
|
110
|
+
* Create a single record. Automatically invalidates the records list and
|
|
111
|
+
* count caches for this entity on success.
|
|
112
|
+
*
|
|
113
|
+
* @example
|
|
114
|
+
* ```tsx
|
|
115
|
+
* function NewContactForm({ entityId }: { entityId: string }) {
|
|
116
|
+
* const sdk = useContext(SdkContext);
|
|
117
|
+
* const create = useCreateRecord(sdk, entityId);
|
|
118
|
+
*
|
|
119
|
+
* return (
|
|
120
|
+
* <form
|
|
121
|
+
* onSubmit={async (e) => {
|
|
122
|
+
* e.preventDefault();
|
|
123
|
+
* const data = new FormData(e.currentTarget);
|
|
124
|
+
* await create.mutateAsync({
|
|
125
|
+
* values: {
|
|
126
|
+
* name: data.get("name") as string,
|
|
127
|
+
* email: data.get("email") as string,
|
|
128
|
+
* },
|
|
129
|
+
* });
|
|
130
|
+
* }}
|
|
131
|
+
* >
|
|
132
|
+
* <input name="name" />
|
|
133
|
+
* <input name="email" type="email" />
|
|
134
|
+
* <button disabled={create.isPending}>Save</button>
|
|
135
|
+
* {create.error ? <ErrorBanner error={create.error} /> : null}
|
|
136
|
+
* </form>
|
|
137
|
+
* );
|
|
138
|
+
* }
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
declare function useCreateRecord(sdk: ReoptSDK, entityId: string, options?: UseMutationOptions<EavRecord, Error, CreateRecordInput>): _tanstack_react_query.UseMutationResult<EavRecord, Error, CreateRecordInput, unknown>;
|
|
142
|
+
declare function useUpdateRecord(sdk: ReoptSDK, entityId: string, options?: UseMutationOptions<EavRecord, Error, {
|
|
143
|
+
recordId: string;
|
|
144
|
+
input: UpdateRecordInput;
|
|
145
|
+
}>): _tanstack_react_query.UseMutationResult<EavRecord, Error, {
|
|
146
|
+
recordId: string;
|
|
147
|
+
input: UpdateRecordInput;
|
|
148
|
+
}, unknown>;
|
|
149
|
+
/**
|
|
150
|
+
* Delete a record by id. Pass the recordId directly to `mutateAsync`.
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```tsx
|
|
154
|
+
* const remove = useDeleteRecord(sdk, entityId);
|
|
155
|
+
* <button onClick={() => remove.mutate(record.id)}>Delete</button>
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
declare function useDeleteRecord(sdk: ReoptSDK, entityId: string, options?: UseMutationOptions<void, Error, string>): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
|
|
159
|
+
/**
|
|
160
|
+
* 레코드 upsert mutation. 필터에 매칭되는 레코드가 있으면 업데이트, 없으면 생성.
|
|
161
|
+
*
|
|
162
|
+
* @example
|
|
163
|
+
* ```tsx
|
|
164
|
+
* const upsert = useUpsertRecord(sdk, entityId);
|
|
165
|
+
* await upsert.mutateAsync({
|
|
166
|
+
* filters: [{ attributeId: attrs.key, operator: "eq", value: "theme" }],
|
|
167
|
+
* values: { [attrs.key]: "theme", [attrs.value]: "dark" },
|
|
168
|
+
* });
|
|
169
|
+
* ```
|
|
170
|
+
*/
|
|
171
|
+
declare function useUpsertRecord(sdk: ReoptSDK, entityId: string, options?: UseMutationOptions<UpsertRecordResult<EavRecord>, Error, UpsertRecordInput>): _tanstack_react_query.UseMutationResult<UpsertRecordResult<EavRecord>, Error, UpsertRecordInput, unknown>;
|
|
172
|
+
/**
|
|
173
|
+
* 최대 100개 레코드를 한 번에 생성하는 mutation.
|
|
174
|
+
*
|
|
175
|
+
* @example
|
|
176
|
+
* ```tsx
|
|
177
|
+
* const bulkCreate = useBulkCreateRecords(sdk, entityId);
|
|
178
|
+
* await bulkCreate.mutateAsync([
|
|
179
|
+
* { values: { name: "Alice" } },
|
|
180
|
+
* { values: { name: "Bob" } },
|
|
181
|
+
* ]);
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
184
|
+
declare function useBulkCreateRecords(sdk: ReoptSDK, entityId: string, options?: UseMutationOptions<EavRecord[], Error, CreateRecordInput[]>): _tanstack_react_query.UseMutationResult<EavRecord[], Error, CreateRecordInput[], unknown>;
|
|
185
|
+
/**
|
|
186
|
+
* 최대 100개 레코드를 한 번에 업데이트하는 mutation.
|
|
187
|
+
*/
|
|
188
|
+
declare function useBulkUpdateRecords(sdk: ReoptSDK, entityId: string, options?: UseMutationOptions<EavRecord[], Error, BulkUpdateItem[]>): _tanstack_react_query.UseMutationResult<EavRecord[], Error, BulkUpdateItem[], unknown>;
|
|
189
|
+
/**
|
|
190
|
+
* 최대 100개 레코드를 한 번에 삭제하는 mutation. 삭제된 레코드 수를 반환.
|
|
191
|
+
*/
|
|
192
|
+
declare function useBulkDeleteRecords(sdk: ReoptSDK, entityId: string, options?: UseMutationOptions<number, Error, string[]>): _tanstack_react_query.UseMutationResult<number, Error, string[], unknown>;
|
|
193
|
+
/**
|
|
194
|
+
* 필터에 매칭되는 모든 레코드를 삭제하는 mutation. 삭제된 수를 반환.
|
|
195
|
+
*/
|
|
196
|
+
declare function useDeleteRecordsWhere(sdk: ReoptSDK, entityId: string, options?: UseMutationOptions<number, Error, DeleteWhereInput>): _tanstack_react_query.UseMutationResult<number, Error, DeleteWhereInput, unknown>;
|
|
197
|
+
/**
|
|
198
|
+
* BrandApp AI 크레딧 잔액 조회
|
|
199
|
+
*
|
|
200
|
+
* @example
|
|
201
|
+
* ```tsx
|
|
202
|
+
* const { data: credits } = useAiCredits(sdk);
|
|
203
|
+
* // credits?.balance, credits?.limit, credits?.status
|
|
204
|
+
* ```
|
|
205
|
+
*/
|
|
206
|
+
declare function useAiCredits(sdk: ReoptSDK, options?: Omit<UseQueryOptions<CreditInfo>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<NoInfer<CreditInfo>, Error>;
|
|
207
|
+
/**
|
|
208
|
+
* BrandApp AI 사용 가능 모델 목록
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* ```tsx
|
|
212
|
+
* const { data: models } = useAiModels(sdk);
|
|
213
|
+
* // models?.map(m => m.id)
|
|
214
|
+
* ```
|
|
215
|
+
*/
|
|
216
|
+
declare function useAiModels(sdk: ReoptSDK, options?: Omit<UseQueryOptions<ModelInfo[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<NoInfer<ModelInfo[]>, Error>;
|
|
217
|
+
/**
|
|
218
|
+
* BrandApp에서 사용 가능한 커스텀 에이전트 목록
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* ```tsx
|
|
222
|
+
* const { data: agents } = useAiAgents(sdk);
|
|
223
|
+
* // agents?.map(a => ({ id: a.id, name: a.name, defaultModel: a.defaultModel }))
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
declare function useAiAgents(sdk: ReoptSDK, options?: Omit<UseQueryOptions<AgentInfo[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<NoInfer<AgentInfo[]>, Error>;
|
|
227
|
+
/**
|
|
228
|
+
* AI 텍스트 생성 (non-streaming) mutation
|
|
229
|
+
*
|
|
230
|
+
* @example
|
|
231
|
+
* ```tsx
|
|
232
|
+
* const completion = useAiCompletion(sdk);
|
|
233
|
+
*
|
|
234
|
+
* const handleSubmit = () => {
|
|
235
|
+
* completion.mutate({
|
|
236
|
+
* messages: [{ role: "user", content: "안녕하세요" }],
|
|
237
|
+
* model: "anthropic/claude-haiku-4.5",
|
|
238
|
+
* });
|
|
239
|
+
* };
|
|
240
|
+
* // completion.data?.message.content
|
|
241
|
+
* ```
|
|
242
|
+
*/
|
|
243
|
+
declare function useAiCompletion(sdk: ReoptSDK, options?: UseMutationOptions<CompletionResult, ReoptSDKError, CompletionOptions>): _tanstack_react_query.UseMutationResult<CompletionResult, ReoptSDKError, CompletionOptions, unknown>;
|
|
244
|
+
/**
|
|
245
|
+
* AI 이미지 생성 mutation
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* ```tsx
|
|
249
|
+
* const imageGen = useAiImageGenerate(sdk);
|
|
250
|
+
*
|
|
251
|
+
* const handleGenerate = () => {
|
|
252
|
+
* imageGen.mutate({
|
|
253
|
+
* prompt: "브랜드 배너 이미지",
|
|
254
|
+
* style: "minimalist",
|
|
255
|
+
* aspectRatio: "16:9",
|
|
256
|
+
* });
|
|
257
|
+
* };
|
|
258
|
+
* // imageGen.data?.url
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
declare function useAiImageGenerate(sdk: ReoptSDK, options?: UseMutationOptions<ImageGenerateResult, ReoptSDKError, ImageGenerateOptions>): _tanstack_react_query.UseMutationResult<ImageGenerateResult, ReoptSDKError, ImageGenerateOptions, unknown>;
|
|
262
|
+
/**
|
|
263
|
+
* Post 목록 조회
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* ```tsx
|
|
267
|
+
* const { data } = usePostList(sdk, { status: "published", limit: 10 });
|
|
268
|
+
* // data?.records (Post[]), data?.total
|
|
269
|
+
* ```
|
|
270
|
+
*/
|
|
271
|
+
declare function usePostList(sdk: ReoptSDK, query?: ListPostsQuery, options?: Omit<UseQueryOptions<CmsPaginatedResponse<Post>>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<NoInfer<CmsPaginatedResponse<Post>>, Error>;
|
|
272
|
+
/**
|
|
273
|
+
* 단일 Post 조회 (with document content)
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* ```tsx
|
|
277
|
+
* const { data: post } = usePost(sdk, postId);
|
|
278
|
+
* // post?.title, post?.document.contentRich
|
|
279
|
+
* ```
|
|
280
|
+
*/
|
|
281
|
+
declare function usePost(sdk: ReoptSDK, postId: string, options?: Omit<UseQueryOptions<PostDetail>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<NoInfer<PostDetail>, Error>;
|
|
282
|
+
/**
|
|
283
|
+
* PostGroup 목록 조회
|
|
284
|
+
*
|
|
285
|
+
* @example
|
|
286
|
+
* ```tsx
|
|
287
|
+
* const { data } = usePostGroupList(sdk, { sortBy: "name" });
|
|
288
|
+
* // data?.records (PostGroup[]), data?.total
|
|
289
|
+
* ```
|
|
290
|
+
*/
|
|
291
|
+
declare function usePostGroupList(sdk: ReoptSDK, query?: ListPostGroupsQuery, options?: Omit<UseQueryOptions<CmsPaginatedResponse<PostGroup>>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<NoInfer<CmsPaginatedResponse<PostGroup>>, Error>;
|
|
292
|
+
/**
|
|
293
|
+
* 단일 PostGroup 조회
|
|
294
|
+
*
|
|
295
|
+
* @example
|
|
296
|
+
* ```tsx
|
|
297
|
+
* const { data: group } = usePostGroup(sdk, groupId);
|
|
298
|
+
* // group?.name, group?.postCount
|
|
299
|
+
* ```
|
|
300
|
+
*/
|
|
301
|
+
declare function usePostGroup(sdk: ReoptSDK, groupId: string, options?: Omit<UseQueryOptions<PostGroup>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<NoInfer<PostGroup>, Error>;
|
|
302
|
+
/**
|
|
303
|
+
* Slug 기반 단일 Post 조회. 외부 사이트의 `/blog/[slug]` 같은 라우트에서
|
|
304
|
+
* id 매핑 없이 사용. (서버 컴포넌트에서는 `sdk.cms.posts.getBySlug`를
|
|
305
|
+
* 직접 호출하는 편이 추가 hop을 피할 수 있다.)
|
|
306
|
+
*
|
|
307
|
+
* @example
|
|
308
|
+
* ```tsx
|
|
309
|
+
* const { data: post } = usePostBySlug(sdk, slug);
|
|
310
|
+
* ```
|
|
311
|
+
*/
|
|
312
|
+
declare function usePostBySlug(sdk: ReoptSDK, slug: string, opts?: {
|
|
313
|
+
groupId?: string;
|
|
314
|
+
}, options?: Omit<UseQueryOptions<PostDetail>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<NoInfer<PostDetail>, Error>;
|
|
315
|
+
/**
|
|
316
|
+
* Brand 범위에서 사용된 포스트 태그 목록.
|
|
317
|
+
*
|
|
318
|
+
* @example
|
|
319
|
+
* ```tsx
|
|
320
|
+
* const { data: tags } = useCmsTags(sdk, { groupId: blogId });
|
|
321
|
+
* // tags?.[0]: { id, text, postCount }
|
|
322
|
+
* ```
|
|
323
|
+
*/
|
|
324
|
+
declare function useCmsTags(sdk: ReoptSDK, query?: ListTagsQuery, options?: Omit<UseQueryOptions<Tag[]>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<NoInfer<Tag[]>, Error>;
|
|
325
|
+
/**
|
|
326
|
+
* 파일 목록 조회
|
|
327
|
+
*
|
|
328
|
+
* @example
|
|
329
|
+
* ```tsx
|
|
330
|
+
* const { data } = useFiles(sdk, { contentType: "image/*", sortBy: "createdAt" });
|
|
331
|
+
* // data?.data (FileInfo[]), data?.meta
|
|
332
|
+
* ```
|
|
333
|
+
*/
|
|
334
|
+
declare function useFiles(sdk: ReoptSDK, query?: FileListQuery, options?: Omit<UseQueryOptions<FileListResponse>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<NoInfer<FileListResponse>, Error>;
|
|
335
|
+
/**
|
|
336
|
+
* 단일 파일 조회
|
|
337
|
+
*
|
|
338
|
+
* @example
|
|
339
|
+
* ```tsx
|
|
340
|
+
* const { data: file } = useFile(sdk, fileId);
|
|
341
|
+
* // file?.name, file?.url
|
|
342
|
+
* ```
|
|
343
|
+
*/
|
|
344
|
+
declare function useFile(sdk: ReoptSDK, fileId: string, options?: Omit<UseQueryOptions<FileInfo>, "queryKey" | "queryFn">): _tanstack_react_query.UseQueryResult<NoInfer<FileInfo>, Error>;
|
|
345
|
+
/**
|
|
346
|
+
* 파일 삭제 mutation
|
|
347
|
+
*
|
|
348
|
+
* @example
|
|
349
|
+
* ```tsx
|
|
350
|
+
* const deleteFile = useDeleteFile(sdk);
|
|
351
|
+
* await deleteFile.mutateAsync("file-uuid");
|
|
352
|
+
* ```
|
|
353
|
+
*/
|
|
354
|
+
declare function useDeleteFile(sdk: ReoptSDK, options?: UseMutationOptions<void, Error, string>): _tanstack_react_query.UseMutationResult<void, Error, string, unknown>;
|
|
355
|
+
/**
|
|
356
|
+
* 파일 업로드 mutation
|
|
357
|
+
*
|
|
358
|
+
* @example
|
|
359
|
+
* ```tsx
|
|
360
|
+
* const upload = useUploadFile(sdk);
|
|
361
|
+
* const file = await upload.mutateAsync({
|
|
362
|
+
* file: blob,
|
|
363
|
+
* options: { name: "banner.png" },
|
|
364
|
+
* });
|
|
365
|
+
* console.log(file.url);
|
|
366
|
+
* ```
|
|
367
|
+
*/
|
|
368
|
+
declare function useUploadFile(sdk: ReoptSDK, options?: UseMutationOptions<FileInfo, Error, {
|
|
369
|
+
file: Blob | Uint8Array | File;
|
|
370
|
+
options?: UploadOptions;
|
|
371
|
+
}>): _tanstack_react_query.UseMutationResult<FileInfo, Error, {
|
|
372
|
+
file: Blob | Uint8Array | File;
|
|
373
|
+
options?: UploadOptions;
|
|
374
|
+
}, unknown>;
|
|
375
|
+
|
|
376
|
+
export { type UseAiStreamOptions, type UseAiStreamReturn, 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 };
|