@reopt-ai/brandapp-sdk 4.2.0 → 4.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.
- package/CHANGELOG.md +31 -2
- package/README.md +1 -1
- package/dist/ai/index.d.ts +1 -1
- package/dist/ai/index.js +1 -1
- package/dist/ai-provider/index.js +77 -66
- package/dist/analytics/index.d.ts +1 -1
- package/dist/analytics/index.js +1 -1
- package/dist/auth/index.d.ts +1 -1
- package/dist/auth/index.js +1 -1
- package/dist/better-auth/index.d.ts +2 -2
- package/dist/better-auth/index.js +2 -2
- package/dist/{client-D5F6-YYU.d.ts → client-7I-mz3Dw.d.ts} +2 -2
- package/dist/{client-bXAnGNzC.d.ts → client-BSW0Ncjj.d.ts} +2 -2
- package/dist/{client-CNPfjmT0.d.ts → client-Bfutv3LK.d.ts} +2 -2
- package/dist/{client-ClX0it9Z.js → client-C4sDbXto.js} +70 -6
- package/dist/{client-DjgoTlfv.d.ts → client-C6OXGMMV.d.ts} +2 -2
- package/dist/{client-CeYaCY1n.d.ts → client-COKDtHO9.d.ts} +7 -5
- package/dist/{client-BOEyVc8V.d.ts → client-CniCGdmi.d.ts} +2 -2
- package/dist/{client-C1zORyWz.js → client-CuM8MNS5.js} +2 -2
- package/dist/{client-DEY11EBB.d.ts → client-D1AFtJRw.d.ts} +10 -10
- package/dist/{client-DY62Nb7m.js → client-DYkDNPyN.js} +2 -2
- package/dist/{client-C5CsGtWK.js → client-D_6WdWsc.js} +3 -3
- package/dist/{client-DYammrtw.d.ts → client-Dmvtr1nS.d.ts} +2 -2
- package/dist/{client-oDJVL5JF.js → client-DsM84EZZ.js} +3 -3
- package/dist/{client-DfGEiRKb.js → client-DuATTvcr.js} +2 -2
- package/dist/{client-C3hlUyaZ.js → client-EG1p7FL0.js} +2 -2
- package/dist/{client-CRim5LCH.d.ts → client-IUSZDJio.d.ts} +2 -2
- package/dist/{client-DR5Eb36i.js → client-afAv7Ebi.js} +16 -9
- package/dist/{client-Dd1QpCUq.js → client-mD6o-qVl.js} +2 -2
- package/dist/{client-B_7XihyW.js → client-s2uJ3OML.js} +2 -2
- package/dist/{client-BBxhqs8l.d.ts → client-yKeRJnIB.d.ts} +2 -2
- package/dist/cms/index.d.ts +1 -1
- package/dist/cms/index.js +1 -1
- package/dist/{config-BrJAy95F.js → config-C_OFYAgP.js} +5 -5
- package/dist/{config-D28P8iwm.d.ts → config-D3SblxWt.d.ts} +19 -2
- package/dist/dev/index.js +15 -5
- package/dist/eav/index.d.ts +4 -4
- package/dist/eav/index.js +3 -33
- package/dist/eav/migrate.d.ts +2 -2
- package/dist/eav/schema.d.ts +2 -2
- package/dist/{errors-BnIRV-Px.d.ts → errors-U3TsyWVq.d.ts} +2 -2
- package/dist/feedback/index.d.ts +1 -1
- package/dist/feedback/index.js +1 -1
- package/dist/files/index.d.ts +1 -1
- package/dist/files/index.js +1 -1
- package/dist/{http-client-Dw_U7Wgx.js → http-client-BUbFBOvG.js} +2 -2
- package/dist/{index-CBPdczmp.d.ts → index-BnAYxnwq.d.ts} +12 -12
- package/dist/index.d.ts +5 -5
- package/dist/index.js +12 -12
- package/dist/logout/index.d.ts +1 -1
- package/dist/logout/index.js +1 -1
- package/dist/plans/index.d.ts +1 -1
- package/dist/plans/index.js +1 -1
- package/dist/push/index.d.ts +1 -1
- package/dist/push/index.js +1 -1
- package/dist/{query-l08AoqXP.js → query-BkdTSuB5.js} +2 -2
- package/dist/react/hooks.d.ts +6 -6
- package/dist/react/hooks.js +1 -1
- package/dist/terms/index.d.ts +1 -1
- package/dist/terms/index.js +1 -1
- package/dist/testing/index.d.ts +1 -1
- package/docs/api-reference.md +20 -12
- package/docs/cms.md +3 -1
- package/docs/dev-server.md +1 -1
- package/docs/errors.md +16 -16
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,35 @@ This project adheres to [Semantic Versioning](https://semver.org/).
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [4.4.0] — 2026-09-07
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- `RECORDS_PAGE_LIMIT_MAX`(=100)를 `@reopt-ai/brandapp-sdk/eav`에서 export한다 — 페이지 루프 상수를 소비자가 손으로 적지 않아도 된다.
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- `eav.records.list()`가 서버 상한을 넘긴 `limit`을 요청 전에 `BadRequestError`로
|
|
19
|
+
거절한다(상한 100, `RECORDS_PAGE_LIMIT_MAX`로 export). 조용히 100으로 낮추지
|
|
20
|
+
않는다 — 200을 요청한 호출부가 100건을 "전부"로 읽으면 400보다 나쁘다. 여러
|
|
21
|
+
페이지가 필요하면 `records.listAll()`을 쓴다. `listAll()`·`backfill()`의 페이지
|
|
22
|
+
크기는 결과 총량에 영향이 없으므로 상한으로 낮춘다.
|
|
23
|
+
프로덕션 2026-08-30~09-05: `limit: 200`이 닷새간 400을 받는 동안 크레딧
|
|
24
|
+
dead-letter 스윕이 한 건도 정산되지 않았고, SDK는 상한을 말한 적이 없었다.
|
|
25
|
+
- 문서: sitemap·RSS 예시가 `cms.posts.list({ limit: 200 })`을 가르치고 있었다 —
|
|
26
|
+
cms 목록 상한도 100이라 그대로 따라 쓰면 400이다.
|
|
27
|
+
|
|
28
|
+
## [4.3.0] — 2026-09-05
|
|
29
|
+
|
|
30
|
+
### Added
|
|
31
|
+
|
|
32
|
+
- `FeedbackStatus`에 `resolved`(해결됨)가 추가됐다 — `responded`는 "답변함", `resolved`는 "고쳐졌다/결론이 났다"를 뜻한다. `feedback.list({ status })` 필터와 응답의 `status`에 그대로 나타난다.
|
|
33
|
+
|
|
34
|
+
### Changed
|
|
35
|
+
|
|
36
|
+
- 로컬 dev EAV 서버의 레코드/엔티티 상한이 production과 같이 `BRANDAPP_EAV_MAX_RECORDS_PER_ENTITY`를 읽는다(기본 10,000).
|
|
37
|
+
- 문서: 필터 연산자 목록에 `in`/`notIn`, `expiresAt`는 클라이언트 계산 절대 시각이라는 주의.
|
|
38
|
+
|
|
10
39
|
## [4.2.0] — 2026-08-30
|
|
11
40
|
|
|
12
41
|
### Added
|
|
@@ -399,7 +428,7 @@ OIDC **Single Logout** 상호운용 — reopt와 외부 앱 사이 세션 종료
|
|
|
399
428
|
|
|
400
429
|
- **에러 형태 통일** — HTTP 상태 → typed 에러 매핑을 단일 출처(`mapHttpStatusToError`)로
|
|
401
430
|
통합. 비스트림 HTTP / SSE 스트리밍 / AI SDK provider가 동일한 코드·진단을 갖는 에러를
|
|
402
|
-
생성한다. **스트리밍 402
|
|
431
|
+
생성한다. **스트리밍 402/사용량 소진이 이제 `CreditLimitError`(`.diagnostic` 포함)로**
|
|
403
432
|
표면화된다(이전엔 `STREAM_ERROR`로 뭉뚱그려짐).
|
|
404
433
|
- **provider 에러 = `APICallError`** — AI SDK provider는 bare `Error` 대신
|
|
405
434
|
`APICallError`를 던진다 → AI SDK 내장 재시도(`isRetryable`)가 동작하고, `error.data.code`
|
|
@@ -433,7 +462,7 @@ OIDC **Single Logout** 상호운용 — reopt와 외부 앱 사이 세션 종료
|
|
|
433
462
|
생성이 스트림 도중 끊기던 문제, provider가 첫 토큰 후 stall 시 무한 hang하던 문제를
|
|
434
463
|
함께 해소. 공통 로직은 신규 `core/abort.ts`(`createManagedAbort`).
|
|
435
464
|
- **비멱등 재시도 차단** — POST/PATCH는 5xx·네트워크·timeout 시 기본적으로 **재시도하지
|
|
436
|
-
않음**(중복 레코드 생성·중복
|
|
465
|
+
않음**(중복 레코드 생성·중복 사용량 차감·중복 동의 방지). 429(rate limit)는 메서드와
|
|
437
466
|
무관하게 항상 재시도. 옵트인 `config.retryNonIdempotent: true`로 복원 가능. 변이
|
|
438
467
|
요청에는 `Idempotency-Key`(요청 id) 헤더를 부여해 서버측 dedup 연동 가능.
|
|
439
468
|
- **백오프 jitter + cap** — 지수 백오프에 full jitter(`[base/2, base]`)와 30s 상한 추가
|
package/README.md
CHANGED
|
@@ -112,7 +112,7 @@ import { toRssFeed, toSitemapItems } from "@reopt-ai/brandapp-sdk/cms";
|
|
|
112
112
|
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
|
|
113
113
|
const { records } = await sdk.cms.posts.list({
|
|
114
114
|
status: "published",
|
|
115
|
-
limit:
|
|
115
|
+
limit: 100, // 상한 100 — 넘기면 400이다
|
|
116
116
|
});
|
|
117
117
|
return toSitemapItems(records, { siteUrl: "https://www.example.com" });
|
|
118
118
|
}
|
package/dist/ai/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as CompletionOptions, c as FinishReason, d as MessageRole, f as ModelInfo, i as ChatMessage, l as ImageGenerateOptions, m as StreamEvent, n as createReoptAiClient, o as CompletionResult, p as StreamDoneData, r as AgentInfo, s as CreditInfo, t as ReoptAiClient, u as ImageGenerateResult } from "../client-
|
|
1
|
+
import { a as CompletionOptions, c as FinishReason, d as MessageRole, f as ModelInfo, i as ChatMessage, l as ImageGenerateOptions, m as StreamEvent, n as createReoptAiClient, o as CompletionResult, p as StreamDoneData, r as AgentInfo, s as CreditInfo, t as ReoptAiClient, u as ImageGenerateResult } from "../client-D1AFtJRw.js";
|
|
2
2
|
export { type AgentInfo, type ChatMessage, type CompletionOptions, type CompletionResult, type CreditInfo, type FinishReason, type ImageGenerateOptions, type ImageGenerateResult, type MessageRole, type ModelInfo, ReoptAiClient, type StreamDoneData, type StreamEvent, createReoptAiClient };
|
package/dist/ai/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { i as resolveBaseUrl, j as mapHttpStatusToError, n as SDK_VERSION, o as validateConfig, r as assertBrowserSafe } from "../config-
|
|
1
|
+
import { i as resolveBaseUrl, j as mapHttpStatusToError, n as SDK_VERSION, o as validateConfig, r as assertBrowserSafe } from "../config-C_OFYAgP.js";
|
|
2
2
|
import { t as createManagedAbort } from "../abort--nOBFN4M.js";
|
|
3
3
|
import { t as createAuthHeader } from "../encoding-Bwfm3iaE.js";
|
|
4
4
|
import { t as createSSELineProcessor } from "../sse-parser-FMjxM7sY.js";
|
|
5
|
-
import { APICallError, NoSuchModelError } from "@ai-sdk/provider";
|
|
5
|
+
import { APICallError, NoSuchModelError, UnsupportedFunctionalityError } from "@ai-sdk/provider";
|
|
6
6
|
|
|
7
7
|
//#region src/ai-provider/provider-http.ts
|
|
8
8
|
/**
|
|
@@ -201,15 +201,9 @@ var BrandappImageModel = class {
|
|
|
201
201
|
feature: "seed",
|
|
202
202
|
details: "BrandApp AI API does not support seed parameter"
|
|
203
203
|
});
|
|
204
|
-
if (options.files?.length)
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
details: "BrandApp AI API does not support image editing or variation generation"
|
|
208
|
-
});
|
|
209
|
-
if (options.mask != null) warnings.push({
|
|
210
|
-
type: "unsupported",
|
|
211
|
-
feature: "mask",
|
|
212
|
-
details: "BrandApp AI API does not support inpainting masks"
|
|
204
|
+
if (options.files?.length || options.mask != null) throw new UnsupportedFunctionalityError({
|
|
205
|
+
functionality: "image editing / reference images / masks",
|
|
206
|
+
message: "BrandApp AI API does not accept reference images or masks. No image was generated."
|
|
213
207
|
});
|
|
214
208
|
return warnings;
|
|
215
209
|
}
|
|
@@ -225,8 +219,8 @@ function arrayBufferToBase64(bytes) {
|
|
|
225
219
|
* AI SDK 프롬프트 → BrandApp API 메시지 배열 (+ 손실 변환 보고).
|
|
226
220
|
*
|
|
227
221
|
* BrandApp API는 텍스트 전용이라 비-text part는 손실된다. 무엇이 손실됐는지를
|
|
228
|
-
* `droppedParts`로
|
|
229
|
-
*
|
|
222
|
+
* `droppedParts`로 돌려준다. 호출자는 파일 입력이면 요청을 거절하고,
|
|
223
|
+
* 도구 이력의 텍스트 변환이면 warning으로 알린다.
|
|
230
224
|
*
|
|
231
225
|
* - system: content 문자열 그대로
|
|
232
226
|
* - user: text part만 추출하여 결합 / file part는 드롭("file" 보고)
|
|
@@ -236,47 +230,50 @@ function arrayBufferToBase64(bytes) {
|
|
|
236
230
|
function convertPromptToBrandappMessages(prompt) {
|
|
237
231
|
const messages = [];
|
|
238
232
|
const dropped = /* @__PURE__ */ new Set();
|
|
239
|
-
for (const message of prompt)
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
content: message.content
|
|
244
|
-
});
|
|
245
|
-
break;
|
|
246
|
-
case "user": {
|
|
247
|
-
const textParts = [];
|
|
248
|
-
for (const part of message.content) if (part.type === "text") textParts.push(part.text);
|
|
249
|
-
else dropped.add("file");
|
|
250
|
-
if (textParts.length > 0) messages.push({
|
|
251
|
-
role: "user",
|
|
252
|
-
content: textParts.join("\n")
|
|
253
|
-
});
|
|
254
|
-
break;
|
|
255
|
-
}
|
|
256
|
-
case "assistant": {
|
|
257
|
-
const textParts = message.content.filter((part) => part.type === "text").map((part) => part.text);
|
|
258
|
-
const toolCallParts = message.content.filter((part) => part.type === "tool-call").map((part) => `[Tool Call: ${part.toolName}(${typeof part.input === "string" ? part.input : JSON.stringify(part.input)})]`);
|
|
259
|
-
if (toolCallParts.length > 0) dropped.add("tool-call");
|
|
260
|
-
const allText = [...textParts, ...toolCallParts].join("\n");
|
|
261
|
-
if (allText.length > 0) messages.push({
|
|
262
|
-
role: "assistant",
|
|
263
|
-
content: allText
|
|
264
|
-
});
|
|
265
|
-
break;
|
|
266
|
-
}
|
|
267
|
-
case "tool": {
|
|
268
|
-
const resultParts = message.content.filter((part) => part.type === "tool-result").map((part) => {
|
|
269
|
-
const output = typeof part.output === "string" ? part.output : JSON.stringify(part.output);
|
|
270
|
-
return `[Tool Result: ${part.toolName}] ${output}`;
|
|
271
|
-
});
|
|
272
|
-
if (resultParts.length > 0) {
|
|
273
|
-
dropped.add("tool-result");
|
|
233
|
+
for (const message of prompt) {
|
|
234
|
+
if (message.role !== "system" && message.content.some((part) => part.type === "file" || part.type === "tool-result" && part.output.type === "content" && part.output.value.some((item) => item.type !== "text"))) dropped.add("file");
|
|
235
|
+
switch (message.role) {
|
|
236
|
+
case "system":
|
|
274
237
|
messages.push({
|
|
238
|
+
role: "system",
|
|
239
|
+
content: message.content
|
|
240
|
+
});
|
|
241
|
+
break;
|
|
242
|
+
case "user": {
|
|
243
|
+
const textParts = [];
|
|
244
|
+
for (const part of message.content) if (part.type === "text") textParts.push(part.text);
|
|
245
|
+
else dropped.add("file");
|
|
246
|
+
if (textParts.length > 0) messages.push({
|
|
275
247
|
role: "user",
|
|
276
|
-
content:
|
|
248
|
+
content: textParts.join("\n")
|
|
249
|
+
});
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
case "assistant": {
|
|
253
|
+
const textParts = message.content.filter((part) => part.type === "text").map((part) => part.text);
|
|
254
|
+
const toolCallParts = message.content.filter((part) => part.type === "tool-call").map((part) => `[Tool Call: ${part.toolName}(${typeof part.input === "string" ? part.input : JSON.stringify(part.input)})]`);
|
|
255
|
+
if (toolCallParts.length > 0) dropped.add("tool-call");
|
|
256
|
+
const allText = [...textParts, ...toolCallParts].join("\n");
|
|
257
|
+
if (allText.length > 0) messages.push({
|
|
258
|
+
role: "assistant",
|
|
259
|
+
content: allText
|
|
260
|
+
});
|
|
261
|
+
break;
|
|
262
|
+
}
|
|
263
|
+
case "tool": {
|
|
264
|
+
const resultParts = message.content.filter((part) => part.type === "tool-result").map((part) => {
|
|
265
|
+
const output = typeof part.output === "string" ? part.output : JSON.stringify(part.output);
|
|
266
|
+
return `[Tool Result: ${part.toolName}] ${output}`;
|
|
277
267
|
});
|
|
268
|
+
if (resultParts.length > 0) {
|
|
269
|
+
dropped.add("tool-result");
|
|
270
|
+
messages.push({
|
|
271
|
+
role: "user",
|
|
272
|
+
content: resultParts.join("\n")
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
break;
|
|
278
276
|
}
|
|
279
|
-
break;
|
|
280
277
|
}
|
|
281
278
|
}
|
|
282
279
|
return {
|
|
@@ -417,10 +414,14 @@ var BrandappLanguageModel = class {
|
|
|
417
414
|
}
|
|
418
415
|
collectWarnings(options, droppedParts = []) {
|
|
419
416
|
const warnings = [];
|
|
417
|
+
if (droppedParts.includes("file")) throw new UnsupportedFunctionalityError({
|
|
418
|
+
functionality: "image/file input",
|
|
419
|
+
message: "BrandApp AI API accepts text only. File input cannot be omitted."
|
|
420
|
+
});
|
|
420
421
|
for (const part of droppedParts) warnings.push({
|
|
421
422
|
type: "unsupported",
|
|
422
|
-
feature: part
|
|
423
|
-
details:
|
|
423
|
+
feature: part,
|
|
424
|
+
details: `BrandApp AI API does not support ${part} parts natively; converted to text (lossy).`
|
|
424
425
|
});
|
|
425
426
|
if (options.topP != null) warnings.push({
|
|
426
427
|
type: "unsupported",
|
|
@@ -447,15 +448,9 @@ var BrandappLanguageModel = class {
|
|
|
447
448
|
feature: "stopSequences",
|
|
448
449
|
details: "BrandApp AI API does not support stopSequences parameter"
|
|
449
450
|
});
|
|
450
|
-
if (options.responseFormat?.type === "json")
|
|
451
|
-
type: "
|
|
452
|
-
|
|
453
|
-
details: "BrandApp AI API does not support JSON response format directly. Use prompt engineering instead."
|
|
454
|
-
});
|
|
455
|
-
if (options.tools?.length) warnings.push({
|
|
456
|
-
type: "unsupported",
|
|
457
|
-
feature: "tools",
|
|
458
|
-
details: "BrandApp AI API does not support tool calling. Tools will be ignored."
|
|
451
|
+
if (options.responseFormat?.type === "json" || options.tools?.length || options.toolChoice && options.toolChoice.type !== "none" && options.toolChoice.type !== "auto") throw new UnsupportedFunctionalityError({
|
|
452
|
+
functionality: options.responseFormat?.type === "json" ? "structured output" : "tool calling",
|
|
453
|
+
message: "BrandApp AI API supports text generation only. This request cannot be executed as plain text."
|
|
459
454
|
});
|
|
460
455
|
if (options.seed != null) warnings.push({
|
|
461
456
|
type: "unsupported",
|
|
@@ -471,6 +466,7 @@ var BrandappLanguageModel = class {
|
|
|
471
466
|
let emittedTextStart = false;
|
|
472
467
|
let emittedTextEnd = false;
|
|
473
468
|
let emittedFinish = false;
|
|
469
|
+
let emittedError = false;
|
|
474
470
|
const textId = "text-0";
|
|
475
471
|
function processSSEEvent({ event, data }, controller) {
|
|
476
472
|
if (includeRawChunks) controller.enqueue({
|
|
@@ -505,6 +501,12 @@ var BrandappLanguageModel = class {
|
|
|
505
501
|
}
|
|
506
502
|
try {
|
|
507
503
|
const meta = JSON.parse(data);
|
|
504
|
+
if (![
|
|
505
|
+
meta.usage?.promptTokens,
|
|
506
|
+
meta.usage?.completionTokens,
|
|
507
|
+
meta.usage?.creditCost,
|
|
508
|
+
meta.creditsRemaining
|
|
509
|
+
].every(Number.isFinite)) throw new Error("Invalid BrandApp completion metadata");
|
|
508
510
|
controller.enqueue({
|
|
509
511
|
type: "finish",
|
|
510
512
|
usage: {
|
|
@@ -520,7 +522,10 @@ var BrandappLanguageModel = class {
|
|
|
520
522
|
reasoning: void 0
|
|
521
523
|
}
|
|
522
524
|
},
|
|
523
|
-
finishReason:
|
|
525
|
+
finishReason: emittedError ? {
|
|
526
|
+
unified: "error",
|
|
527
|
+
raw: "stream_error"
|
|
528
|
+
} : meta.finishReason ? {
|
|
524
529
|
unified: meta.finishReason.unified,
|
|
525
530
|
raw: meta.finishReason.raw
|
|
526
531
|
} : {
|
|
@@ -532,7 +537,12 @@ var BrandappLanguageModel = class {
|
|
|
532
537
|
creditsRemaining: meta.creditsRemaining
|
|
533
538
|
} }
|
|
534
539
|
});
|
|
535
|
-
} catch {
|
|
540
|
+
} catch (error) {
|
|
541
|
+
emittedError = true;
|
|
542
|
+
controller.enqueue({
|
|
543
|
+
type: "error",
|
|
544
|
+
error
|
|
545
|
+
});
|
|
536
546
|
controller.enqueue({
|
|
537
547
|
type: "finish",
|
|
538
548
|
usage: {
|
|
@@ -549,14 +559,15 @@ var BrandappLanguageModel = class {
|
|
|
549
559
|
}
|
|
550
560
|
},
|
|
551
561
|
finishReason: {
|
|
552
|
-
unified: "
|
|
553
|
-
raw: "
|
|
562
|
+
unified: "error",
|
|
563
|
+
raw: "invalid_completion_metadata"
|
|
554
564
|
}
|
|
555
565
|
});
|
|
556
566
|
}
|
|
557
567
|
emittedFinish = true;
|
|
558
568
|
break;
|
|
559
569
|
case "error":
|
|
570
|
+
emittedError = true;
|
|
560
571
|
try {
|
|
561
572
|
const err = JSON.parse(data);
|
|
562
573
|
const mapped = typeof err.status === "number" ? mapHttpStatusToError(err.status, err.code, err.message) : new Error(err.message ?? "Stream error");
|
|
@@ -637,7 +648,7 @@ var BrandappLanguageModel = class {
|
|
|
637
648
|
* Vercel AI SDK와 호환되는 커스텀 프로바이더를 생성합니다.
|
|
638
649
|
*
|
|
639
650
|
* **지원**: `generateText()`, `streamText()` (텍스트 생성), `generateImage()`
|
|
640
|
-
* (이미지 생성), `providerMetadata.brandapp`(
|
|
651
|
+
* (이미지 생성), `providerMetadata.brandapp`(사용량/사용량), `providerOptions.brandapp`.
|
|
641
652
|
*
|
|
642
653
|
* **미지원** (호출 시 `warnings`로 알리고 해당 부분은 무시됨): tool/function calling,
|
|
643
654
|
* 구조화 출력(`generateObject`/`responseFormat: json`), 비전·파일 입력, `topP`/`topK`/
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as createReoptAnalyticsClient, r as AnalyticsConfig, t as ReoptAnalyticsClient } from "../client-
|
|
1
|
+
import { n as createReoptAnalyticsClient, r as AnalyticsConfig, t as ReoptAnalyticsClient } from "../client-7I-mz3Dw.js";
|
|
2
2
|
import { identify, pageView, setConsent, track } from "@reopt-ai/data-sdk";
|
|
3
3
|
//#region src/analytics/browser.d.ts
|
|
4
4
|
type BrandappAnalytics = {
|
package/dist/analytics/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as createReoptAnalyticsClient, t as ReoptAnalyticsClient } from "../client-
|
|
1
|
+
import { n as createReoptAnalyticsClient, t as ReoptAnalyticsClient } from "../client-EG1p7FL0.js";
|
|
2
2
|
import { getInstance, identify, init, pageView, setConsent, track } from "@reopt-ai/data-sdk";
|
|
3
3
|
|
|
4
4
|
//#region src/analytics/browser.ts
|
package/dist/auth/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as UserInfoClaims, n as createReoptAuthClient, r as LinkCurrentUserResult, t as ReoptAuthClient } from "../client-
|
|
1
|
+
import { i as UserInfoClaims, n as createReoptAuthClient, r as LinkCurrentUserResult, t as ReoptAuthClient } from "../client-Bfutv3LK.js";
|
|
2
2
|
//#region src/auth/session.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* 세션 쿠키 검증 — apps/id의 Better Auth `/api/auth/get-session`을 호출해
|
package/dist/auth/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as ReoptSDKConfig, t as REOPT_BASE_URLS } from "../config-
|
|
1
|
+
import { n as ReoptSDKConfig, t as REOPT_BASE_URLS } from "../config-D3SblxWt.js";
|
|
2
2
|
import { i as REOPT_PROVIDER_ID, n as AdapterRequestBody, r as REOPT_DEFAULT_SCOPES, t as AdapterOperation } from "../types-MXLudLBP.js";
|
|
3
|
-
import { T as isReoptSDKError, _ as RateLimitError, t as AuthError, v as ReoptSDKError, x as ServerError } from "../errors-
|
|
3
|
+
import { T as isReoptSDKError, _ as RateLimitError, t as AuthError, v as ReoptSDKError, x as ServerError } from "../errors-U3TsyWVq.js";
|
|
4
4
|
import { AdapterFactory } from "better-auth/adapters";
|
|
5
5
|
import { BetterAuthOptions, BetterAuthPlugin } from "better-auth";
|
|
6
6
|
//#region src/better-auth/adapter.d.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { O as isReoptSDKError, S as ReoptSDKError, a as resolveIdBaseUrl, s as AuthError, t as REOPT_BASE_URLS, w as ServerError, x as RateLimitError } from "../config-
|
|
2
|
-
import { t as BaseHttpClient } from "../http-client-
|
|
1
|
+
import { O as isReoptSDKError, S as ReoptSDKError, a as resolveIdBaseUrl, s as AuthError, t as REOPT_BASE_URLS, w as ServerError, x as RateLimitError } from "../config-C_OFYAgP.js";
|
|
2
|
+
import { t as BaseHttpClient } from "../http-client-BUbFBOvG.js";
|
|
3
3
|
import { n as REOPT_PROVIDER_ID, t as REOPT_DEFAULT_SCOPES } from "../types-DjDRszNj.js";
|
|
4
4
|
import { createAdapterFactory } from "better-auth/adapters";
|
|
5
5
|
import { genericOAuth } from "better-auth/plugins";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as ReoptSDKConfig } from "./config-
|
|
1
|
+
import { n as ReoptSDKConfig } from "./config-D3SblxWt.js";
|
|
2
2
|
//#region src/analytics/types.d.ts
|
|
3
3
|
/** `GET /brandapp/{id}/analytics/config` — 브랜드의 reopt-data 브라우저 수집 설정. */
|
|
4
4
|
type AnalyticsConfig = {
|
|
@@ -21,4 +21,4 @@ declare class ReoptAnalyticsClient {
|
|
|
21
21
|
declare function createReoptAnalyticsClient(config: ReoptSDKConfig): ReoptAnalyticsClient;
|
|
22
22
|
//#endregion
|
|
23
23
|
export { createReoptAnalyticsClient as n, AnalyticsConfig as r, ReoptAnalyticsClient as t };
|
|
24
|
-
//# sourceMappingURL=client-
|
|
24
|
+
//# sourceMappingURL=client-7I-mz3Dw.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as ReoptSDKConfig } from "./config-
|
|
1
|
+
import { n as ReoptSDKConfig } from "./config-D3SblxWt.js";
|
|
2
2
|
//#region src/push/types.d.ts
|
|
3
3
|
/** Push provider — native token kind. */
|
|
4
4
|
type PushProvider = "fcm" | "apns";
|
|
@@ -50,4 +50,4 @@ declare class ReoptPushClient {
|
|
|
50
50
|
declare function createReoptPushClient(config: ReoptSDKConfig): ReoptPushClient;
|
|
51
51
|
//#endregion
|
|
52
52
|
export { RegisterPushTokenInput as a, UnregisterPushTokenInput as c, PushProvider as i, UnregisterPushTokenResult as l, createReoptPushClient as n, RegisterPushTokenResult as o, PushPlatform as r, RegisteredPushDevice as s, ReoptPushClient as t };
|
|
53
|
-
//# sourceMappingURL=client-
|
|
53
|
+
//# sourceMappingURL=client-BSW0Ncjj.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as ReoptSDKConfig } from "./config-
|
|
1
|
+
import { n as ReoptSDKConfig } from "./config-D3SblxWt.js";
|
|
2
2
|
//#region src/auth/types.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* User-scoped auth types.
|
|
@@ -68,4 +68,4 @@ declare class ReoptAuthClient {
|
|
|
68
68
|
declare function createReoptAuthClient(config: ReoptSDKConfig): ReoptAuthClient;
|
|
69
69
|
//#endregion
|
|
70
70
|
export { UserInfoClaims as i, createReoptAuthClient as n, LinkCurrentUserResult as r, ReoptAuthClient as t };
|
|
71
|
-
//# sourceMappingURL=client-
|
|
71
|
+
//# sourceMappingURL=client-Bfutv3LK.d.ts.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
1
|
+
import { u as BadRequestError } from "./config-C_OFYAgP.js";
|
|
2
|
+
import { t as BaseHttpClient } from "./http-client-BUbFBOvG.js";
|
|
3
|
+
import { t as buildQuery } from "./query-BkdTSuB5.js";
|
|
3
4
|
|
|
4
5
|
//#region src/eav/cache.ts
|
|
5
6
|
var SchemaCache = class {
|
|
@@ -39,8 +40,70 @@ var SchemaCache = class {
|
|
|
39
40
|
}
|
|
40
41
|
};
|
|
41
42
|
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/eav/types.ts
|
|
45
|
+
/**
|
|
46
|
+
* Every filter operator the EAV record endpoints accept.
|
|
47
|
+
*
|
|
48
|
+
* Exported as a runtime value on purpose: the type alone cannot be compared
|
|
49
|
+
* against anything at test time, and this vocabulary is a copy — the server
|
|
50
|
+
* owns it in `apps/web/server/hono/routes/brandapp-eav-schemas.ts` and this
|
|
51
|
+
* package cannot import across the deployment boundary. The copy is held to
|
|
52
|
+
* the original by `apps/web/server/mcp/__tests__/eav-filter-operator-parity.test.ts`,
|
|
53
|
+
* which reads *this* array rather than a hand-written list.
|
|
54
|
+
*/
|
|
55
|
+
const ATTRIBUTE_FILTER_OPERATORS = [
|
|
56
|
+
"eq",
|
|
57
|
+
"neq",
|
|
58
|
+
"contains",
|
|
59
|
+
"gt",
|
|
60
|
+
"lt",
|
|
61
|
+
"gte",
|
|
62
|
+
"lte",
|
|
63
|
+
"is_null",
|
|
64
|
+
"is_not_null",
|
|
65
|
+
"after",
|
|
66
|
+
"before",
|
|
67
|
+
"in",
|
|
68
|
+
"not_in"
|
|
69
|
+
];
|
|
70
|
+
/** Maximum number of entries in one `in` / `not_in` list (server-enforced). */
|
|
71
|
+
const ATTRIBUTE_FILTER_LIST_MAX = 100;
|
|
72
|
+
/**
|
|
73
|
+
* Maximum page size accepted by `GET /entities/:id/records` (server-enforced).
|
|
74
|
+
*
|
|
75
|
+
* 🔑 The server is the source of truth — `listRecordsQuerySchema.limit` in
|
|
76
|
+
* `apps/web/server/hono/routes/brandapp-eav-schemas.ts` is `.max(100)`, and
|
|
77
|
+
* `__tests__/eav-records-page-limit.test.ts` fails if the two drift apart.
|
|
78
|
+
* Asking for more is a 400, never a larger page: production 2026-08-30~09-05
|
|
79
|
+
* (Sentry ANGSKI-WEB-18) sent `limit=200` for five days and the credit
|
|
80
|
+
* dead-letter sweep died on every run. Use `records.listAll()` to read past
|
|
81
|
+
* one page.
|
|
82
|
+
*/
|
|
83
|
+
const RECORDS_PAGE_LIMIT_MAX = 100;
|
|
84
|
+
|
|
42
85
|
//#endregion
|
|
43
86
|
//#region src/eav/client.ts
|
|
87
|
+
/**
|
|
88
|
+
* Reject a page size the server will reject anyway — before the request leaves
|
|
89
|
+
* the process, naming the ceiling and the way past it.
|
|
90
|
+
*
|
|
91
|
+
* 🔑 Refusing beats silently clamping here: a caller that asked for 200 and
|
|
92
|
+
* quietly got 100 would read a truncated page as "everything". That is exactly
|
|
93
|
+
* how production 2026-08-30~09-05 (Sentry ANGSKI-WEB-18) burned five days —
|
|
94
|
+
* `limit: maxRecords` was 200, every request 400'd, and the credit dead-letter
|
|
95
|
+
* sweep never settled a single owner.
|
|
96
|
+
*/
|
|
97
|
+
function assertPageLimit(limit) {
|
|
98
|
+
if (limit === void 0) return;
|
|
99
|
+
if (Number.isInteger(limit) && limit >= 1 && limit <= 100) return;
|
|
100
|
+
throw new BadRequestError(`limit must be an integer between 1 and ${100} (got ${limit}). Use records.listAll() to read every record across pages.`);
|
|
101
|
+
}
|
|
102
|
+
/** Page size for the paging helpers, held inside the server's accepted range. */
|
|
103
|
+
function clampPageLimit(limit) {
|
|
104
|
+
if (!Number.isFinite(limit)) return 100;
|
|
105
|
+
return Math.min(Math.max(1, Math.floor(limit)), 100);
|
|
106
|
+
}
|
|
44
107
|
function createReoptEavClient(config) {
|
|
45
108
|
const http = new BaseHttpClient(config, `/api/v1/brandapp/${config.brandappId}/eav`);
|
|
46
109
|
let entityNameMap = null;
|
|
@@ -132,6 +195,7 @@ function createReoptEavClient(config) {
|
|
|
132
195
|
* ```
|
|
133
196
|
*/
|
|
134
197
|
async list(entityId, query) {
|
|
198
|
+
assertPageLimit(query?.limit);
|
|
135
199
|
const qs = buildQuery(query ?? {});
|
|
136
200
|
return (await http.fetch("GET", `/entities/${entityId}/records${qs}`)).data;
|
|
137
201
|
},
|
|
@@ -281,7 +345,7 @@ function createReoptEavClient(config) {
|
|
|
281
345
|
*/
|
|
282
346
|
async *listAll(entityId, query) {
|
|
283
347
|
let page = 1;
|
|
284
|
-
const limit = query?.limit ?? 100;
|
|
348
|
+
const limit = clampPageLimit(query?.limit ?? 100);
|
|
285
349
|
while (true) {
|
|
286
350
|
const res = await client.records.list(entityId, {
|
|
287
351
|
...query,
|
|
@@ -316,7 +380,7 @@ function createReoptEavClient(config) {
|
|
|
316
380
|
*/
|
|
317
381
|
async backfill(entityId, opts) {
|
|
318
382
|
const concurrency = Math.max(1, opts.concurrency ?? 5);
|
|
319
|
-
const pageSize =
|
|
383
|
+
const pageSize = clampPageLimit(opts.pageSize ?? 100);
|
|
320
384
|
const batchSize = Math.min(Math.max(1, opts.batchSize ?? MAX_BULK), MAX_BULK);
|
|
321
385
|
const total = await client.records.count(entityId, {
|
|
322
386
|
authUserId: opts.authUserId,
|
|
@@ -499,5 +563,5 @@ function createReoptEavClient(config) {
|
|
|
499
563
|
}
|
|
500
564
|
|
|
501
565
|
//#endregion
|
|
502
|
-
export { createReoptEavClient as t };
|
|
503
|
-
//# sourceMappingURL=client-
|
|
566
|
+
export { RECORDS_PAGE_LIMIT_MAX as i, ATTRIBUTE_FILTER_LIST_MAX as n, ATTRIBUTE_FILTER_OPERATORS as r, createReoptEavClient as t };
|
|
567
|
+
//# sourceMappingURL=client-C4sDbXto.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as ListRecordsQuery, C as EavAttribute, D as EavRecord, E as EavEntity, F as
|
|
1
|
+
import { A as ListRecordsQuery, C as EavAttribute, D as EavRecord, E as EavEntity, F as UpdateRecordInput, I as UpsertRecordInput, L as UpsertRecordResult, N as UpdateAttributeInput, P as UpdateEntityInput, S as DeleteWhereInput, _ as BulkUpdateItem, b as CreateEntityInput, c as InferValues, f as AttributeFilter, g as BackfillResult, h as BackfillOptions, j as PaginatedResponse, l as SchemaDef, n as ReoptSDKConfig, s as EntityDef, v as CountRecordsQuery, x as CreateRecordInput, y as CreateAttributeInput } from "./config-D3SblxWt.js";
|
|
2
2
|
//#region src/eav/typed-client.d.ts
|
|
3
3
|
/** EavRecord with typed values instead of Record<string, unknown> */
|
|
4
4
|
type TypedEavRecord<V> = Omit<EavRecord, "values"> & {
|
|
@@ -100,4 +100,4 @@ type ReoptEavClient<S extends SchemaDef = SchemaDef> = {
|
|
|
100
100
|
declare function createReoptEavClient<S extends SchemaDef = SchemaDef>(config: ReoptSDKConfig<S>): ReoptEavClient<S>;
|
|
101
101
|
//#endregion
|
|
102
102
|
export { TypedEavRecord as i, createReoptEavClient as n, EntityClient as r, ReoptEavClient as t };
|
|
103
|
-
//# sourceMappingURL=client-
|
|
103
|
+
//# sourceMappingURL=client-C6OXGMMV.d.ts.map
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { n as ReoptSDKConfig } from "./config-
|
|
1
|
+
import { n as ReoptSDKConfig } from "./config-D3SblxWt.js";
|
|
2
2
|
//#region src/feedback/types.d.ts
|
|
3
3
|
/**
|
|
4
|
-
* Feedback processing status. `
|
|
5
|
-
*
|
|
4
|
+
* Feedback processing status. `responded` means staff have answered but the
|
|
5
|
+
* matter may still be open; `resolved` means the workspace declared it fixed or
|
|
6
|
+
* concluded. `reopened` means the customer replied after the staff had answered
|
|
7
|
+
* — the thread is waiting on the workspace again.
|
|
6
8
|
*/
|
|
7
|
-
type FeedbackStatus = "new" | "in_progress" | "responded" | "reopened" | "archived";
|
|
9
|
+
type FeedbackStatus = "new" | "in_progress" | "responded" | "resolved" | "reopened" | "archived";
|
|
8
10
|
/** Who wrote a message in the feedback thread. */
|
|
9
11
|
type FeedbackReplyAuthor = "staff" | "customer";
|
|
10
12
|
/**
|
|
@@ -144,4 +146,4 @@ declare class ReoptFeedbackClient {
|
|
|
144
146
|
declare function createReoptFeedbackClient(config: ReoptSDKConfig): ReoptFeedbackClient;
|
|
145
147
|
//#endregion
|
|
146
148
|
export { CreateFeedbackResult as a, FeedbackListMeta as c, FeedbackReplyAuthor as d, FeedbackStatus as f, CreateFeedbackReplyResult as i, FeedbackListResult as l, RateFeedbackReplyResult as m, createReoptFeedbackClient as n, Feedback as o, ListFeedbackQuery as p, CreateFeedbackInput as r, FeedbackDetail as s, ReoptFeedbackClient as t, FeedbackReply as u };
|
|
147
|
-
//# sourceMappingURL=client-
|
|
149
|
+
//# sourceMappingURL=client-COKDtHO9.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as ReoptSDKConfig } from "./config-
|
|
1
|
+
import { n as ReoptSDKConfig } from "./config-D3SblxWt.js";
|
|
2
2
|
//#region src/files/types.d.ts
|
|
3
3
|
/** 파일 정보 */
|
|
4
4
|
type FileInfo = {
|
|
@@ -269,4 +269,4 @@ declare class ReoptFileClient {
|
|
|
269
269
|
declare function createReoptFileClient(config: ReoptSDKConfig): ReoptFileClient;
|
|
270
270
|
//#endregion
|
|
271
271
|
export { FileListQuery as a, FolderInfo as c, UpdateFolderInput as d, UploadOptions as f, FileInfo as i, FolderListQuery as l, createReoptFileClient as n, FileListResponse as o, CreateFolderInput as r, FileUsageInfo as s, ReoptFileClient as t, UpdateFileInput as u };
|
|
272
|
-
//# sourceMappingURL=client-
|
|
272
|
+
//# sourceMappingURL=client-CniCGdmi.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as BaseHttpClient } from "./http-client-
|
|
1
|
+
import { t as BaseHttpClient } from "./http-client-BUbFBOvG.js";
|
|
2
2
|
|
|
3
3
|
//#region src/push/client.ts
|
|
4
4
|
var ReoptPushClient = class {
|
|
@@ -25,4 +25,4 @@ function createReoptPushClient(config) {
|
|
|
25
25
|
|
|
26
26
|
//#endregion
|
|
27
27
|
export { createReoptPushClient as n, ReoptPushClient as t };
|
|
28
|
-
//# sourceMappingURL=client-
|
|
28
|
+
//# sourceMappingURL=client-CuM8MNS5.js.map
|