@reopt-ai/brandapp-sdk 4.1.0 → 4.2.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 (65) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/ai/index.d.ts +1 -1
  3. package/dist/ai/index.js +1 -1
  4. package/dist/ai-provider/index.js +1 -1
  5. package/dist/analytics/index.d.ts +1 -1
  6. package/dist/analytics/index.js +1 -1
  7. package/dist/auth/index.d.ts +1 -1
  8. package/dist/auth/index.js +1 -1
  9. package/dist/better-auth/index.d.ts +12 -2
  10. package/dist/better-auth/index.js +8 -3
  11. package/dist/{client-DHZ484kb.d.ts → client-BBxhqs8l.d.ts} +2 -2
  12. package/dist/{client-A4YrHjDc.d.ts → client-BOEyVc8V.d.ts} +2 -2
  13. package/dist/{client-Dnp7_J0-.js → client-B_7XihyW.js} +2 -2
  14. package/dist/{client-D_7G37OB.js → client-C1zORyWz.js} +2 -2
  15. package/dist/{client-2IaU8yUs.js → client-C3hlUyaZ.js} +2 -2
  16. package/dist/{client-CTefnLKY.js → client-C5CsGtWK.js} +3 -3
  17. package/dist/{client-yBQen4Yi.d.ts → client-CNPfjmT0.d.ts} +2 -2
  18. package/dist/{client-BGLDrf3N.d.ts → client-CRim5LCH.d.ts} +2 -2
  19. package/dist/{client-Ckm-i_Du.d.ts → client-CeYaCY1n.d.ts} +2 -2
  20. package/dist/{client-CHp-oNJB.js → client-ClX0it9Z.js} +3 -3
  21. package/dist/{client-DZu4msTG.d.ts → client-D5F6-YYU.d.ts} +2 -2
  22. package/dist/{client-DPbXH8tr.d.ts → client-DEY11EBB.d.ts} +2 -2
  23. package/dist/{client-Dx3sYx7V.js → client-DR5Eb36i.js} +4 -4
  24. package/dist/{client-SwByFT8p.js → client-DY62Nb7m.js} +2 -2
  25. package/dist/{client-BTS6Ewv_.d.ts → client-DYammrtw.d.ts} +2 -2
  26. package/dist/{client-DE3FvPFs.js → client-Dd1QpCUq.js} +2 -2
  27. package/dist/{client-CP9RSAzn.js → client-DfGEiRKb.js} +2 -2
  28. package/dist/{client-CAGo56KO.d.ts → client-DjgoTlfv.d.ts} +2 -2
  29. package/dist/{client-DfEeaOsQ.d.ts → client-bXAnGNzC.d.ts} +2 -2
  30. package/dist/{client-mvcEj1Vq.js → client-oDJVL5JF.js} +3 -3
  31. package/dist/cms/index.d.ts +1 -1
  32. package/dist/cms/index.js +1 -1
  33. package/dist/{config-tEsB7QhQ.js → config-BrJAy95F.js} +17 -3
  34. package/dist/{config-C7WQtC3l.d.ts → config-D28P8iwm.d.ts} +42 -4
  35. package/dist/dev/index.d.ts +1 -1
  36. package/dist/dev/index.js +99 -16
  37. package/dist/eav/index.d.ts +13 -4
  38. package/dist/eav/index.js +46 -3
  39. package/dist/eav/migrate.d.ts +4 -4
  40. package/dist/eav/migrate.js +1 -1
  41. package/dist/eav/schema.d.ts +2 -2
  42. package/dist/{errors-CRCcErNC.d.ts → errors-BnIRV-Px.d.ts} +9 -2
  43. package/dist/feedback/index.d.ts +1 -1
  44. package/dist/feedback/index.js +1 -1
  45. package/dist/files/index.d.ts +1 -1
  46. package/dist/files/index.js +1 -1
  47. package/dist/{http-client-CCFmwnaQ.js → http-client-Dw_U7Wgx.js} +2 -2
  48. package/dist/{index-DV_OWwx5.d.ts → index-C6fyJTud.d.ts} +7 -1
  49. package/dist/{index-DJMr3ixA.d.ts → index-CBPdczmp.d.ts} +12 -12
  50. package/dist/index.d.ts +6 -6
  51. package/dist/index.js +13 -13
  52. package/dist/logout/index.d.ts +1 -1
  53. package/dist/logout/index.js +1 -1
  54. package/dist/plans/index.d.ts +1 -1
  55. package/dist/plans/index.js +1 -1
  56. package/dist/push/index.d.ts +1 -1
  57. package/dist/push/index.js +1 -1
  58. package/dist/{query-Bsgb85OE.js → query-l08AoqXP.js} +2 -2
  59. package/dist/react/hooks.d.ts +5 -5
  60. package/dist/terms/index.d.ts +1 -1
  61. package/dist/terms/index.js +1 -1
  62. package/dist/testing/index.d.ts +2 -2
  63. package/docs/api-reference.md +34 -0
  64. package/docs/errors.md +2 -0
  65. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,32 @@ This project adheres to [Semantic Versioning](https://semver.org/).
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [4.2.0] — 2026-08-30
11
+
12
+ ### Added
13
+
14
+ - EAV 레코드에 `version`(낙관적 동시성 토큰)·`expiresAt`(TTL)이 응답에 실린다.
15
+ `records.update(entityId, id, { ifVersion })`는 읽은 version과 다르면 412
16
+ `PreconditionFailedError`로 거부한다 — 자체 version 속성 + read-modify-write 우회가
17
+ 필요 없다. `increments: { [attributeId]: delta }`는 number 속성을 서버에서 원자
18
+ 가감한다(동시 호출이 서로를 잃지 않는다). `expiresAt`(create·update, ISO 8601)은
19
+ 지나면 읽기·count·unique 검사에서 사라지고 서버 크론이 매시 물리 삭제한다 —
20
+ claim/lease/큐 엔티티를 unique 키 + TTL 하나로 대체할 수 있다. `update`의 `values`는
21
+ 이제 optional(increments·expiresAt만 보내는 호출 허용). 로컬 dev 서버가 같은 의미를
22
+ 미러한다.
23
+ - 필터 후보가 인메모리 상한(10,000행)을 넘는 요청은 422 `QUERY_TOO_BROAD`로 명시적으로
24
+ 거부된다(조용한 절단 없음) — `eq`/`in`처럼 인덱스로 좁혀지는 필터나 `authUserId`를 앞에
25
+ 둘 것.
26
+
27
+ ### Fixed
28
+
29
+ - `createReoptOAuth()`가 authorize/token/userinfo 엔드포인트를 명시한다. Better Auth 1.7은
30
+ discovery를 init 때 한 번만 가져오고, `accountIssuer`가 고정돼 있으면 실패해도 init은
31
+ 살지만 엔드포인트가 비어 그 인스턴스의 로그인이 전부 죽었다(재시작 전까지). 명시값은
32
+ `??=`라 discovery가 덮지 못한다.
33
+ - 로컬 개발 EAV 서버가 브랜드앱당 엔티티를 50개로 제한하지 않으며, 같은 이름의
34
+ 엔티티 생성 요청은 기존 엔티티를 반환해 멱등하게 처리한다.
35
+
10
36
  ## [4.1.0] — 2026-08-24
11
37
 
12
38
  ### Added
@@ -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-DPbXH8tr.js";
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-DEY11EBB.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,3 +1,3 @@
1
- import { n as createReoptAiClient, t as ReoptAiClient } from "../client-Dx3sYx7V.js";
1
+ import { n as createReoptAiClient, t as ReoptAiClient } from "../client-DR5Eb36i.js";
2
2
 
3
3
  export { ReoptAiClient, createReoptAiClient };
@@ -1,4 +1,4 @@
1
- import { A as mapHttpStatusToError, i as resolveBaseUrl, n as SDK_VERSION, o as validateConfig, r as assertBrowserSafe } from "../config-tEsB7QhQ.js";
1
+ import { i as resolveBaseUrl, j as mapHttpStatusToError, n as SDK_VERSION, o as validateConfig, r as assertBrowserSafe } from "../config-BrJAy95F.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";
@@ -1,4 +1,4 @@
1
- import { n as createReoptAnalyticsClient, r as AnalyticsConfig, t as ReoptAnalyticsClient } from "../client-DZu4msTG.js";
1
+ import { n as createReoptAnalyticsClient, r as AnalyticsConfig, t as ReoptAnalyticsClient } from "../client-D5F6-YYU.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 = {
@@ -1,4 +1,4 @@
1
- import { n as createReoptAnalyticsClient, t as ReoptAnalyticsClient } from "../client-2IaU8yUs.js";
1
+ import { n as createReoptAnalyticsClient, t as ReoptAnalyticsClient } from "../client-C3hlUyaZ.js";
2
2
  import { getInstance, identify, init, pageView, setConsent, track } from "@reopt-ai/data-sdk";
3
3
 
4
4
  //#region src/analytics/browser.ts
@@ -1,4 +1,4 @@
1
- import { i as UserInfoClaims, n as createReoptAuthClient, r as LinkCurrentUserResult, t as ReoptAuthClient } from "../client-yBQen4Yi.js";
1
+ import { i as UserInfoClaims, n as createReoptAuthClient, r as LinkCurrentUserResult, t as ReoptAuthClient } from "../client-CNPfjmT0.js";
2
2
  //#region src/auth/session.d.ts
3
3
  /**
4
4
  * 세션 쿠키 검증 — apps/id의 Better Auth `/api/auth/get-session`을 호출해
@@ -1,4 +1,4 @@
1
- import { n as createReoptAuthClient, t as ReoptAuthClient } from "../client-CP9RSAzn.js";
1
+ import { n as createReoptAuthClient, t as ReoptAuthClient } from "../client-DfGEiRKb.js";
2
2
 
3
3
  //#region src/auth/session.ts
4
4
  /**
@@ -1,6 +1,6 @@
1
- import { n as ReoptSDKConfig, t as REOPT_BASE_URLS } from "../config-C7WQtC3l.js";
1
+ import { n as ReoptSDKConfig, t as REOPT_BASE_URLS } from "../config-D28P8iwm.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 { _ as ReoptSDKError, b as ServerError, g as RateLimitError, t as AuthError, w as isReoptSDKError } from "../errors-CRCcErNC.js";
3
+ import { T as isReoptSDKError, _ as RateLimitError, t as AuthError, v as ReoptSDKError, x as ServerError } from "../errors-BnIRV-Px.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
@@ -25,6 +25,16 @@ declare function createReoptAdapter(config: ReoptSDKConfig): AdapterFactory<Bett
25
25
  type ReoptOAuthOptions = ReoptSDKConfig & {
26
26
  /** Additional OAuth scopes */
27
27
  additionalScopes?: string[];
28
+ /**
29
+ * Account namespace (`account.issuer`) for users signed in through Reopt.
30
+ * Defaults to the id host (`https://id.reopt.ai`), which is exactly what
31
+ * Reopt's OIDC discovery document reports as `issuer` — so the default
32
+ * changes nothing for existing accounts.
33
+ *
34
+ * Set this only if you point `idBaseUrl` at a proxy whose discovery
35
+ * `issuer` differs from the URL you configured.
36
+ */
37
+ accountIssuer?: string;
28
38
  /**
29
39
  * How this client authenticates at Reopt's token endpoint. Must equal the
30
40
  * `token_endpoint_auth_method` the client was **registered** with — Better
@@ -1,5 +1,5 @@
1
- import { C as ServerError, D as isReoptSDKError, a as resolveIdBaseUrl, b as RateLimitError, s as AuthError, t as REOPT_BASE_URLS, x as ReoptSDKError } from "../config-tEsB7QhQ.js";
2
- import { t as BaseHttpClient } from "../http-client-CCFmwnaQ.js";
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-BrJAy95F.js";
2
+ import { t as BaseHttpClient } from "../http-client-Dw_U7Wgx.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";
@@ -160,9 +160,14 @@ function createReoptAdapter(config) {
160
160
  function createReoptOAuth(options) {
161
161
  if (typeof window !== "undefined") throw new Error("[@reopt-ai/brandapp-sdk] createReoptOAuth() must be called on the server. It uses clientSecret — exposing it to the browser is a security risk. For client-side OAuth sign-in, use signInWithReopt() from '@reopt-ai/brandapp-sdk/better-auth/client' instead.");
162
162
  if (!options.clientId || !options.clientSecret) throw new Error("[@reopt-ai/brandapp-sdk] createReoptOAuth() requires clientId and clientSecret.");
163
+ const idBaseUrl = resolveIdBaseUrl(options);
163
164
  return genericOAuth({ config: [{
164
165
  providerId: REOPT_PROVIDER_ID,
165
- discoveryUrl: `${resolveIdBaseUrl(options)}/api/auth/.well-known/openid-configuration`,
166
+ discoveryUrl: `${idBaseUrl}/api/auth/.well-known/openid-configuration`,
167
+ accountIssuer: options.accountIssuer ?? idBaseUrl,
168
+ authorizationUrl: `${idBaseUrl}/api/auth/oauth2/authorize`,
169
+ tokenUrl: `${idBaseUrl}/api/auth/oauth2/token`,
170
+ userInfoUrl: `${idBaseUrl}/api/auth/oauth2/userinfo`,
166
171
  clientId: options.clientId,
167
172
  clientSecret: options.clientSecret,
168
173
  tokenEndpointAuth: { method: options.tokenEndpointAuthMethod ?? "client_secret_post" },
@@ -1,4 +1,4 @@
1
- import { n as ReoptSDKConfig } from "./config-C7WQtC3l.js";
1
+ import { n as ReoptSDKConfig } from "./config-D28P8iwm.js";
2
2
  import { a as CreateConsentsResult, f as WithdrawConsentResult, i as CreateConsentsRequest, l as TermsListResponse, n as ConsentRecord, o as ListTermsOptions, s as TermsItem } from "./types-C69OzBn6.js";
3
3
  //#region src/terms/client.d.ts
4
4
  declare class ReoptTermsClient {
@@ -45,4 +45,4 @@ declare class ReoptTermsClient {
45
45
  declare function createReoptTermsClient(config: ReoptSDKConfig): ReoptTermsClient;
46
46
  //#endregion
47
47
  export { createReoptTermsClient as n, ReoptTermsClient as t };
48
- //# sourceMappingURL=client-DHZ484kb.d.ts.map
48
+ //# sourceMappingURL=client-BBxhqs8l.d.ts.map
@@ -1,4 +1,4 @@
1
- import { n as ReoptSDKConfig } from "./config-C7WQtC3l.js";
1
+ import { n as ReoptSDKConfig } from "./config-D28P8iwm.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-A4YrHjDc.d.ts.map
272
+ //# sourceMappingURL=client-BOEyVc8V.d.ts.map
@@ -1,4 +1,4 @@
1
- import { t as BaseHttpClient } from "./http-client-CCFmwnaQ.js";
1
+ import { t as BaseHttpClient } from "./http-client-Dw_U7Wgx.js";
2
2
 
3
3
  //#region src/terms/client.ts
4
4
  function unwrap(body) {
@@ -80,4 +80,4 @@ function createReoptTermsClient(config) {
80
80
 
81
81
  //#endregion
82
82
  export { createReoptTermsClient as n, ReoptTermsClient as t };
83
- //# sourceMappingURL=client-Dnp7_J0-.js.map
83
+ //# sourceMappingURL=client-B_7XihyW.js.map
@@ -1,4 +1,4 @@
1
- import { t as BaseHttpClient } from "./http-client-CCFmwnaQ.js";
1
+ import { t as BaseHttpClient } from "./http-client-Dw_U7Wgx.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-D_7G37OB.js.map
28
+ //# sourceMappingURL=client-C1zORyWz.js.map
@@ -1,4 +1,4 @@
1
- import { t as BaseHttpClient } from "./http-client-CCFmwnaQ.js";
1
+ import { t as BaseHttpClient } from "./http-client-Dw_U7Wgx.js";
2
2
 
3
3
  //#region src/analytics/client.ts
4
4
  var ReoptAnalyticsClient = class {
@@ -17,4 +17,4 @@ function createReoptAnalyticsClient(config) {
17
17
 
18
18
  //#endregion
19
19
  export { createReoptAnalyticsClient as n, ReoptAnalyticsClient as t };
20
- //# sourceMappingURL=client-2IaU8yUs.js.map
20
+ //# sourceMappingURL=client-C3hlUyaZ.js.map
@@ -1,5 +1,5 @@
1
- import { t as BaseHttpClient } from "./http-client-CCFmwnaQ.js";
2
- import { t as buildQuery } from "./query-Bsgb85OE.js";
1
+ import { t as BaseHttpClient } from "./http-client-Dw_U7Wgx.js";
2
+ import { t as buildQuery } from "./query-l08AoqXP.js";
3
3
 
4
4
  //#region src/cms/client.ts
5
5
  function createReoptCmsClient(config) {
@@ -52,4 +52,4 @@ async list(query) {
52
52
 
53
53
  //#endregion
54
54
  export { createReoptCmsClient as t };
55
- //# sourceMappingURL=client-CTefnLKY.js.map
55
+ //# sourceMappingURL=client-C5CsGtWK.js.map
@@ -1,4 +1,4 @@
1
- import { n as ReoptSDKConfig } from "./config-C7WQtC3l.js";
1
+ import { n as ReoptSDKConfig } from "./config-D28P8iwm.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-yBQen4Yi.d.ts.map
71
+ //# sourceMappingURL=client-CNPfjmT0.d.ts.map
@@ -1,4 +1,4 @@
1
- import { n as ReoptSDKConfig } from "./config-C7WQtC3l.js";
1
+ import { n as ReoptSDKConfig } from "./config-D28P8iwm.js";
2
2
  //#region src/plans/types.d.ts
3
3
  /**
4
4
  * Brandapp Plans types.
@@ -208,4 +208,4 @@ declare class ReoptPlansClient {
208
208
  declare function createReoptPlansClient(config: ReoptSDKConfig): ReoptPlansClient;
209
209
  //#endregion
210
210
  export { CheckoutStatus as a, MeterPricingMode as c, PlanInterval as d, PlanMeter as f, CheckoutSession as i, Plan as l, PlanRequiredTerms as m, createReoptPlansClient as n, CreateCheckoutInput as o, PlanMeterTier as p, CancelSubscriptionResult as r, CurrentPlan as s, ReoptPlansClient as t, PlanBillingModel as u };
211
- //# sourceMappingURL=client-BGLDrf3N.d.ts.map
211
+ //# sourceMappingURL=client-CRim5LCH.d.ts.map
@@ -1,4 +1,4 @@
1
- import { n as ReoptSDKConfig } from "./config-C7WQtC3l.js";
1
+ import { n as ReoptSDKConfig } from "./config-D28P8iwm.js";
2
2
  //#region src/feedback/types.d.ts
3
3
  /**
4
4
  * Feedback processing status. `reopened` means the customer replied after the
@@ -144,4 +144,4 @@ declare class ReoptFeedbackClient {
144
144
  declare function createReoptFeedbackClient(config: ReoptSDKConfig): ReoptFeedbackClient;
145
145
  //#endregion
146
146
  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-Ckm-i_Du.d.ts.map
147
+ //# sourceMappingURL=client-CeYaCY1n.d.ts.map
@@ -1,5 +1,5 @@
1
- import { t as BaseHttpClient } from "./http-client-CCFmwnaQ.js";
2
- import { t as buildQuery } from "./query-Bsgb85OE.js";
1
+ import { t as BaseHttpClient } from "./http-client-Dw_U7Wgx.js";
2
+ import { t as buildQuery } from "./query-l08AoqXP.js";
3
3
 
4
4
  //#region src/eav/cache.ts
5
5
  var SchemaCache = class {
@@ -500,4 +500,4 @@ function createReoptEavClient(config) {
500
500
 
501
501
  //#endregion
502
502
  export { createReoptEavClient as t };
503
- //# sourceMappingURL=client-CHp-oNJB.js.map
503
+ //# sourceMappingURL=client-ClX0it9Z.js.map
@@ -1,4 +1,4 @@
1
- import { n as ReoptSDKConfig } from "./config-C7WQtC3l.js";
1
+ import { n as ReoptSDKConfig } from "./config-D28P8iwm.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-DZu4msTG.d.ts.map
24
+ //# sourceMappingURL=client-D5F6-YYU.d.ts.map
@@ -1,4 +1,4 @@
1
- import { n as ReoptSDKConfig } from "./config-C7WQtC3l.js";
1
+ import { n as ReoptSDKConfig } from "./config-D28P8iwm.js";
2
2
  //#region src/ai/types.d.ts
3
3
  /** 메시지 역할 */
4
4
  type MessageRole = "system" | "user" | "assistant";
@@ -281,4 +281,4 @@ declare class ReoptAiClient {
281
281
  declare function createReoptAiClient(config: ReoptSDKConfig): ReoptAiClient;
282
282
  //#endregion
283
283
  export { CompletionOptions as a, FinishReason as c, MessageRole as d, ModelInfo as f, ChatMessage as i, ImageGenerateOptions as l, StreamEvent as m, createReoptAiClient as n, CompletionResult as o, StreamDoneData as p, AgentInfo as r, CreditInfo as s, ReoptAiClient as t, ImageGenerateResult as u };
284
- //# sourceMappingURL=client-DPbXH8tr.d.ts.map
284
+ //# sourceMappingURL=client-DEY11EBB.d.ts.map
@@ -1,6 +1,6 @@
1
- import { A as mapHttpStatusToError, n as SDK_VERSION, o as validateConfig, x as ReoptSDKError } from "./config-tEsB7QhQ.js";
1
+ import { S as ReoptSDKError, j as mapHttpStatusToError, n as SDK_VERSION, o as validateConfig } from "./config-BrJAy95F.js";
2
2
  import { t as createManagedAbort } from "./abort--nOBFN4M.js";
3
- import { t as BaseHttpClient } from "./http-client-CCFmwnaQ.js";
3
+ import { t as BaseHttpClient } from "./http-client-Dw_U7Wgx.js";
4
4
  import { n as parseSSEStream } from "./sse-parser-FMjxM7sY.js";
5
5
 
6
6
  //#region src/ai/client.ts
@@ -224,7 +224,7 @@ var ReoptAiClient = class {
224
224
  }
225
225
  async fetchSSE(options) {
226
226
  const url = `${this.http.requestBaseUrl}/chat/completions`;
227
- const requestId = globalThis.crypto?.randomUUID?.() ?? `sdk-${"4.1.0"}-${url.length}`;
227
+ const requestId = globalThis.crypto?.randomUUID?.() ?? `sdk-${"4.2.0"}-${url.length}`;
228
228
  const ctx = {
229
229
  method: "POST",
230
230
  url,
@@ -302,4 +302,4 @@ function createReoptAiClient(config) {
302
302
 
303
303
  //#endregion
304
304
  export { createReoptAiClient as n, ReoptAiClient as t };
305
- //# sourceMappingURL=client-Dx3sYx7V.js.map
305
+ //# sourceMappingURL=client-DR5Eb36i.js.map
@@ -1,4 +1,4 @@
1
- import { t as BaseHttpClient } from "./http-client-CCFmwnaQ.js";
1
+ import { t as BaseHttpClient } from "./http-client-Dw_U7Wgx.js";
2
2
 
3
3
  //#region src/feedback/client.ts
4
4
  function buildListQuery(query) {
@@ -83,4 +83,4 @@ function createReoptFeedbackClient(config) {
83
83
 
84
84
  //#endregion
85
85
  export { createReoptFeedbackClient as n, ReoptFeedbackClient as t };
86
- //# sourceMappingURL=client-SwByFT8p.js.map
86
+ //# sourceMappingURL=client-DY62Nb7m.js.map
@@ -1,4 +1,4 @@
1
- import { n as ReoptSDKConfig } from "./config-C7WQtC3l.js";
1
+ import { n as ReoptSDKConfig } from "./config-D28P8iwm.js";
2
2
  import { a as ListTagsQuery, c as PostGroup, d as Tag, i as ListPostsQuery, o as Post, r as ListPostGroupsQuery, s as PostDetail, t as CmsPaginatedResponse } from "./types-BXDcoJHG.js";
3
3
  //#region src/cms/client.d.ts
4
4
  /**
@@ -50,4 +50,4 @@ declare function createReoptCmsClient(config: ReoptSDKConfig): {
50
50
  };
51
51
  //#endregion
52
52
  export { createReoptCmsClient as n, ReoptCmsClient as t };
53
- //# sourceMappingURL=client-BTS6Ewv_.d.ts.map
53
+ //# sourceMappingURL=client-DYammrtw.d.ts.map
@@ -1,4 +1,4 @@
1
- import { t as BaseHttpClient } from "./http-client-CCFmwnaQ.js";
1
+ import { t as BaseHttpClient } from "./http-client-Dw_U7Wgx.js";
2
2
 
3
3
  //#region src/plans/client.ts
4
4
  function unwrap(body) {
@@ -78,4 +78,4 @@ function createReoptPlansClient(config) {
78
78
 
79
79
  //#endregion
80
80
  export { createReoptPlansClient as n, ReoptPlansClient as t };
81
- //# sourceMappingURL=client-DE3FvPFs.js.map
81
+ //# sourceMappingURL=client-Dd1QpCUq.js.map
@@ -1,4 +1,4 @@
1
- import { t as BaseHttpClient } from "./http-client-CCFmwnaQ.js";
1
+ import { t as BaseHttpClient } from "./http-client-Dw_U7Wgx.js";
2
2
 
3
3
  //#region src/auth/client.ts
4
4
  function unwrap(body) {
@@ -50,4 +50,4 @@ function createReoptAuthClient(config) {
50
50
 
51
51
  //#endregion
52
52
  export { createReoptAuthClient as n, ReoptAuthClient as t };
53
- //# sourceMappingURL=client-CP9RSAzn.js.map
53
+ //# sourceMappingURL=client-DfGEiRKb.js.map
@@ -1,4 +1,4 @@
1
- import { A as UpdateEntityInput, C as EavEntity, D as ListRecordsQuery, M as UpsertRecordInput, N as UpsertRecordResult, O as PaginatedResponse, _ as CreateEntityInput, b as EavAttribute, c as InferValues, f as BackfillOptions, g as CreateAttributeInput, h as CountRecordsQuery, j as UpdateRecordInput, k as UpdateAttributeInput, l as SchemaDef, m as BulkUpdateItem, n as ReoptSDKConfig, p as BackfillResult, s as EntityDef, u as AttributeFilter, v as CreateRecordInput, w as EavRecord, y as DeleteWhereInput } from "./config-C7WQtC3l.js";
1
+ import { A as ListRecordsQuery, C as EavAttribute, D as EavRecord, E as EavEntity, F as UpsertRecordInput, I as UpsertRecordResult, M as UpdateAttributeInput, N as UpdateEntityInput, P as UpdateRecordInput, 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-D28P8iwm.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-CAGo56KO.d.ts.map
103
+ //# sourceMappingURL=client-DjgoTlfv.d.ts.map
@@ -1,4 +1,4 @@
1
- import { n as ReoptSDKConfig } from "./config-C7WQtC3l.js";
1
+ import { n as ReoptSDKConfig } from "./config-D28P8iwm.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-DfEeaOsQ.d.ts.map
53
+ //# sourceMappingURL=client-bXAnGNzC.d.ts.map
@@ -1,6 +1,6 @@
1
- import { A as mapHttpStatusToError, n as SDK_VERSION, o as validateConfig, x as ReoptSDKError } from "./config-tEsB7QhQ.js";
1
+ import { S as ReoptSDKError, j as mapHttpStatusToError, n as SDK_VERSION, o as validateConfig } from "./config-BrJAy95F.js";
2
2
  import { t as createManagedAbort } from "./abort--nOBFN4M.js";
3
- import { n as parseFieldErrors, t as BaseHttpClient } from "./http-client-CCFmwnaQ.js";
3
+ import { n as parseFieldErrors, t as BaseHttpClient } from "./http-client-Dw_U7Wgx.js";
4
4
 
5
5
  //#region src/files/client.ts
6
6
  var ReoptFileClient = class {
@@ -270,4 +270,4 @@ function createReoptFileClient(config) {
270
270
 
271
271
  //#endregion
272
272
  export { createReoptFileClient as n, ReoptFileClient as t };
273
- //# sourceMappingURL=client-mvcEj1Vq.js.map
273
+ //# sourceMappingURL=client-oDJVL5JF.js.map
@@ -1,5 +1,5 @@
1
1
  import { a as ListTagsQuery, c as PostGroup, d as Tag, i as ListPostsQuery, l as PostSeo, n as EditorSpec, o as Post, r as ListPostGroupsQuery, s as PostDetail, t as CmsPaginatedResponse, u as PostStatus } from "../types-BXDcoJHG.js";
2
- import { n as createReoptCmsClient, t as ReoptCmsClient } from "../client-BTS6Ewv_.js";
2
+ import { n as createReoptCmsClient, t as ReoptCmsClient } from "../client-DYammrtw.js";
3
3
  //#region src/cms/helpers.d.ts
4
4
  type SeoMetadata = {
5
5
  title?: string;
package/dist/cms/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { t as createReoptCmsClient } from "../client-CTefnLKY.js";
1
+ import { t as createReoptCmsClient } from "../client-C5CsGtWK.js";
2
2
 
3
3
  //#region src/cms/helpers.ts
4
4
  function joinUrl(siteUrl, path) {
@@ -142,6 +142,19 @@ var DuplicateAuthUserError = class extends ConflictError {
142
142
  }
143
143
  };
144
144
  /** 참조한 brandappAuthUser가 이 brandapp에 존재하지 않음. status는 호출 경로에 따라 400 또는 422. */
145
+ /**
146
+ * 412 — `update(..., { ifVersion })`의 version이 현재와 다르다. 레코드를 다시 읽어
147
+ * 새 `version`으로 재시도할 것(CAS 루프).
148
+ */
149
+ var PreconditionFailedError = class extends ReoptSDKError {
150
+ constructor(message, context) {
151
+ super(message, 412, "PRECONDITION_FAILED", context, {
152
+ cause: "레코드가 읽은 뒤 다른 쓰기로 바뀌었습니다(ifVersion 불일치).",
153
+ fix: "레코드를 다시 읽고 새 version으로 다시 시도하세요(CAS 루프)."
154
+ });
155
+ this.name = "PreconditionFailedError";
156
+ }
157
+ };
145
158
  var AuthUserNotFoundError = class extends ReoptSDKError {
146
159
  constructor(message = "Auth user not found in this brandapp", status = 422, context) {
147
160
  super(message, status, "AUTH_USER_NOT_FOUND", context, {
@@ -285,6 +298,7 @@ function mapHttpStatusToError(status, code, message, ctx, fieldErrors) {
285
298
  case 404:
286
299
  if (code === "MODEL_NOT_FOUND") return new ModelNotFoundError(message ?? "Unknown model", ctx);
287
300
  return new NotFoundError(message ?? "Not found", ctx, code ?? "NOT_FOUND");
301
+ case 412: return new PreconditionFailedError(message ?? "Precondition failed", ctx);
288
302
  case 409:
289
303
  if (code === "AUTH_USER_RECORD_EXISTS") return new AuthUserRecordExistsError(message ?? "Auth user already has a record for this entity", ctx);
290
304
  if (code === "DUPLICATE_AUTH_USER") return new DuplicateAuthUserError(message ?? "Duplicate authUserId in bulk create", ctx);
@@ -305,7 +319,7 @@ function mapHttpStatusToError(status, code, message, ctx, fieldErrors) {
305
319
 
306
320
  //#endregion
307
321
  //#region src/core/config.ts
308
- const SDK_VERSION = "4.1.0";
322
+ const SDK_VERSION = "4.2.0";
309
323
  /**
310
324
  * Default API host for EAV / AI / Files / CMS / Terms. Consumers can override
311
325
  * via `config.baseUrl` or the `REOPT_BASE_URL` env var.
@@ -483,5 +497,5 @@ function deriveIdFromBaseUrl(baseUrl) {
483
497
  }
484
498
 
485
499
  //#endregion
486
- export { mapHttpStatusToError as A, ServerError as C, isReoptSDKError as D, isModelAccessError as E, isRequiredTermsError as O, RequiredTermsError as S, isCreditLimitError as T, ModelAccessError as _, resolveIdBaseUrl as a, RateLimitError as b, AuthUserNotFoundError as c, ConflictError as d, ContentFilterError as f, LimitExceededError as g, ForbiddenError as h, resolveBaseUrl as i, isValidationError as k, AuthUserRecordExistsError as l, DuplicateAuthUserError as m, SDK_VERSION as n, validateConfig as o, CreditLimitError as p, assertBrowserSafe as r, AuthError as s, REOPT_BASE_URLS as t, BadRequestError as u, ModelNotFoundError as v, ValidationError as w, ReoptSDKError as x, NotFoundError as y };
487
- //# sourceMappingURL=config-tEsB7QhQ.js.map
500
+ export { isValidationError as A, RequiredTermsError as C, isModelAccessError as D, isCreditLimitError as E, isReoptSDKError as O, ReoptSDKError as S, ValidationError as T, ModelAccessError as _, resolveIdBaseUrl as a, PreconditionFailedError as b, AuthUserNotFoundError as c, ConflictError as d, ContentFilterError as f, LimitExceededError as g, ForbiddenError as h, resolveBaseUrl as i, mapHttpStatusToError as j, isRequiredTermsError as k, AuthUserRecordExistsError as l, DuplicateAuthUserError as m, SDK_VERSION as n, validateConfig as o, CreditLimitError as p, assertBrowserSafe as r, AuthError as s, REOPT_BASE_URLS as t, BadRequestError as u, ModelNotFoundError as v, ServerError as w, RateLimitError as x, NotFoundError as y };
501
+ //# sourceMappingURL=config-BrJAy95F.js.map
@@ -90,22 +90,60 @@ type EavRecord = {
90
90
  values: Record<string, unknown>;
91
91
  createdAt: string;
92
92
  updatedAt: string;
93
+ /**
94
+ * 낙관적 동시성 토큰 — 값 갱신(update·bulkUpdate·upsert·increments)마다 +1.
95
+ * `update(..., { ifVersion })`에 되돌려 보내면 그 사이 다른 쓰기가 있었을 때
96
+ * `PreconditionFailedError`(412)로 거부된다. brandappAuthUser 연결 엔티티는 항상 1.
97
+ */
98
+ version: number;
99
+ /** TTL — 지나면 읽기·유일성 검사에서 사라지고 서버 크론이 물리 삭제한다. */
100
+ expiresAt: string | null;
93
101
  };
94
102
  type CreateRecordInput = {
95
103
  authUserId?: string;
96
104
  values: Record<string, unknown>;
105
+ /** ISO 8601 TTL. brandapp 자유 테이블 전용. */
106
+ expiresAt?: string;
97
107
  };
98
108
  type UpdateRecordInput = {
99
- values: Record<string, unknown>;
109
+ /** 병합할 값. increments·expiresAt만 보낼 때는 생략 가능. */
110
+ values?: Record<string, unknown>;
111
+ /** 읽은 `EavRecord.version`. 불일치면 412 `PreconditionFailedError`. */
112
+ ifVersion?: number;
113
+ /** number 속성 원자 가감 `{ [attributeId]: delta }` — 동시 호출이 서로를 잃지 않는다. */
114
+ increments?: Record<string, number>;
115
+ /** ISO 8601이면 TTL 설정, `null`이면 해제. */
116
+ expiresAt?: string | null;
100
117
  };
101
118
  type BulkUpdateItem = {
102
119
  id: string;
103
120
  values: Record<string, unknown>;
104
121
  };
105
- type AttributeFilterOperator = "eq" | "neq" | "contains" | "gt" | "lt" | "gte" | "lte" | "is_null" | "is_not_null" | "after" | "before";
122
+ /**
123
+ * Every filter operator the EAV record endpoints accept.
124
+ *
125
+ * Exported as a runtime value on purpose: the type alone cannot be compared
126
+ * against anything at test time, and this vocabulary is a copy — the server
127
+ * owns it in `apps/web/server/hono/routes/brandapp-eav-schemas.ts` and this
128
+ * package cannot import across the deployment boundary. The copy is held to
129
+ * the original by `apps/web/server/mcp/__tests__/eav-filter-operator-parity.test.ts`,
130
+ * which reads *this* array rather than a hand-written list.
131
+ */
132
+ declare const ATTRIBUTE_FILTER_OPERATORS: readonly ["eq", "neq", "contains", "gt", "lt", "gte", "lte", "is_null", "is_not_null", "after", "before", "in", "not_in"];
133
+ type AttributeFilterOperator = (typeof ATTRIBUTE_FILTER_OPERATORS)[number];
134
+ /** Scalar accepted inside an `in` / `not_in` list. */
135
+ type AttributeFilterListValue = string | number | boolean | null;
136
+ /** Maximum number of entries in one `in` / `not_in` list (server-enforced). */
137
+ declare const ATTRIBUTE_FILTER_LIST_MAX = 100;
106
138
  type AttributeFilter = {
107
139
  attributeId: string;
108
140
  operator: AttributeFilterOperator;
141
+ /**
142
+ * `in` / `not_in` require a non-empty array of at most
143
+ * {@link ATTRIBUTE_FILTER_LIST_MAX} scalars; the server rejects an empty one
144
+ * with 400 rather than reading it as "no exclusions", because a `not_in: []`
145
+ * that silently matched everything would turn a `deleteWhere` into a wipe.
146
+ */
109
147
  value?: unknown;
110
148
  };
111
149
  type PaginatedResponse<T> = {
@@ -392,5 +430,5 @@ type ReoptSDKConfig<S extends SchemaDef = SchemaDef> = {
392
430
  */
393
431
  declare function resolveBaseUrl(config: ReoptSDKConfig): string;
394
432
  //#endregion
395
- export { UpdateEntityInput as A, EavEntity as C, ListRecordsQuery as D, EavValidation as E, UpsertRecordInput as M, UpsertRecordResult as N, PaginatedResponse as O, EavDataType as S, EavSchemaLinkedTo as T, CreateEntityInput as _, DebugLogger as a, EavAttribute as b, InferValues as c, AttributeFilterOperator as d, BackfillOptions as f, CreateAttributeInput as g, CountRecordsQuery as h, DebugLevel as i, UpdateRecordInput as j, UpdateAttributeInput as k, SchemaDef as l, BulkUpdateItem as m, ReoptSDKConfig as n, AttributeDef as o, BackfillResult as p, resolveBaseUrl as r, EntityDef as s, REOPT_BASE_URLS as t, AttributeFilter as u, CreateRecordInput as v, EavRecord as w, EavAttributeOption as x, DeleteWhereInput as y };
396
- //# sourceMappingURL=config-C7WQtC3l.d.ts.map
433
+ export { ListRecordsQuery as A, EavAttribute as C, EavRecord as D, EavEntity as E, UpsertRecordInput as F, UpsertRecordResult as I, UpdateAttributeInput as M, UpdateEntityInput as N, EavSchemaLinkedTo as O, UpdateRecordInput as P, DeleteWhereInput as S, EavDataType as T, BulkUpdateItem as _, DebugLogger as a, CreateEntityInput as b, InferValues as c, ATTRIBUTE_FILTER_OPERATORS as d, AttributeFilter as f, BackfillResult as g, BackfillOptions as h, DebugLevel as i, PaginatedResponse as j, EavValidation as k, SchemaDef as l, AttributeFilterOperator as m, ReoptSDKConfig as n, AttributeDef as o, AttributeFilterListValue as p, resolveBaseUrl as r, EntityDef as s, REOPT_BASE_URLS as t, ATTRIBUTE_FILTER_LIST_MAX as u, CountRecordsQuery as v, EavAttributeOption as w, CreateRecordInput as x, CreateAttributeInput as y };
434
+ //# sourceMappingURL=config-D28P8iwm.d.ts.map
@@ -1,2 +1,2 @@
1
- import { _ as DevPost, a as SeedAllInput, b as InMemoryStore, c as SeedPostGroupInput, d as SeedTermsItem, f as createDevServer, g as DevEntity, h as DevAttribute, i as ProxyConfig, l as SeedPostInput, m as markdownToEditorSpecMany, n as DevServer, o as SeedData, p as markdownToEditorSpec, r as DevServerOptions, s as SeedOptions, t as DevSchema, u as SeedRecordInput, v as DevPostGroup, x as StoreSnapshot, y as DevRecord } from "../index-DV_OWwx5.js";
1
+ import { _ as DevPost, a as SeedAllInput, b as InMemoryStore, c as SeedPostGroupInput, d as SeedTermsItem, f as createDevServer, g as DevEntity, h as DevAttribute, i as ProxyConfig, l as SeedPostInput, m as markdownToEditorSpecMany, n as DevServer, o as SeedData, p as markdownToEditorSpec, r as DevServerOptions, s as SeedOptions, t as DevSchema, u as SeedRecordInput, v as DevPostGroup, x as StoreSnapshot, y as DevRecord } from "../index-C6fyJTud.js";
2
2
  export { type DevAttribute, type DevEntity, type DevPost, type DevPostGroup, type DevRecord, DevSchema, DevServer, DevServerOptions, InMemoryStore, ProxyConfig, SeedAllInput, SeedData, SeedOptions, SeedPostGroupInput, SeedPostInput, SeedRecordInput, SeedTermsItem, type StoreSnapshot, createDevServer, markdownToEditorSpec, markdownToEditorSpecMany };