@reopt-ai/brandapp-sdk 4.0.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 +35 -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 +22 -0
  6. package/dist/analytics/index.js +44 -0
  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-DUvf9x_b.js → client-B_7XihyW.js} +2 -2
  14. package/dist/{client-2qKKpHVy.js → client-C1zORyWz.js} +2 -2
  15. package/dist/client-C3hlUyaZ.js +20 -0
  16. package/dist/{client-B0uRUF3T.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-CAjqKz8i.js → client-ClX0it9Z.js} +3 -3
  21. package/dist/client-D5F6-YYU.d.ts +24 -0
  22. package/dist/{client-DPbXH8tr.d.ts → client-DEY11EBB.d.ts} +2 -2
  23. package/dist/{client-D72MLGRY.js → client-DR5Eb36i.js} +4 -4
  24. package/dist/{client-DTWpLo8X.js → client-DY62Nb7m.js} +2 -2
  25. package/dist/{client-BTS6Ewv_.d.ts → client-DYammrtw.d.ts} +2 -2
  26. package/dist/{client-Djlg4STl.js → client-Dd1QpCUq.js} +2 -2
  27. package/dist/{client-D9MGqXbn.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-C6USfykM.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-D31PK7eu.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-D1vuc20o.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-CvNJ8zp1.d.ts → index-CBPdczmp.d.ts} +13 -11
  50. package/dist/index.d.ts +6 -6
  51. package/dist/index.js +14 -12
  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-DyiwJX92.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 +11 -2
package/CHANGELOG.md CHANGED
@@ -7,6 +7,41 @@ 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
+
36
+ ## [4.1.0] — 2026-08-24
37
+
38
+ ### Added
39
+
40
+ - `sdk.analytics.getConfig()` + `@reopt-ai/brandapp-sdk/analytics` 서브패스
41
+ `startBrandappAnalytics(sdk)` — 브랜드의 reopt-data 수집 설정(`baseUrl`·`writeKey`)을
42
+ 브랜드앱 자격으로 받아 `@reopt-ai/data-sdk`를 한 번에 초기화한다(RFC-0023).
43
+ `@reopt-ai/data-sdk`는 optional peer — 이 서브패스를 쓰는 소비자만 설치한다.
44
+
10
45
  ## [4.0.0] — 2026-08-21
11
46
 
12
47
  Better Auth **1.7** 이행. 1.7이 generic OAuth를 소셜 제공자 경로로 재작성하고
@@ -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-D72MLGRY.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-D31PK7eu.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";
@@ -0,0 +1,22 @@
1
+ import { n as createReoptAnalyticsClient, r as AnalyticsConfig, t as ReoptAnalyticsClient } from "../client-D5F6-YYU.js";
2
+ import { identify, pageView, setConsent, track } from "@reopt-ai/data-sdk";
3
+ //#region src/analytics/browser.d.ts
4
+ type BrandappAnalytics = {
5
+ track: typeof track;
6
+ identify: typeof identify;
7
+ pageView: typeof pageView;
8
+ setConsent: typeof setConsent;
9
+ };
10
+ /**
11
+ * Fetches the config and initialises the SDK. Returns `null` when analytics is
12
+ * not enabled for the brand (project not provisioned) — callers can `?.` every
13
+ * call and ship the same code either way.
14
+ */
15
+ declare function startBrandappAnalytics(sdk: {
16
+ analytics: ReoptAnalyticsClient;
17
+ }, options?: {
18
+ accessToken?: string;
19
+ }): Promise<BrandappAnalytics | null>;
20
+ //#endregion
21
+ export { type AnalyticsConfig, type BrandappAnalytics, ReoptAnalyticsClient, createReoptAnalyticsClient, startBrandappAnalytics };
22
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,44 @@
1
+ import { n as createReoptAnalyticsClient, t as ReoptAnalyticsClient } from "../client-C3hlUyaZ.js";
2
+ import { getInstance, identify, init, pageView, setConsent, track } from "@reopt-ai/data-sdk";
3
+
4
+ //#region src/analytics/browser.ts
5
+ /**
6
+ * Browser helper — wires `@reopt-ai/data-sdk` with the brand's collection config
7
+ * in one call, so a brandapp page needs no separate analytics credential.
8
+ *
9
+ * `@reopt-ai/data-sdk` is an optional peer dependency: import this module only
10
+ * from code that installs it.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * import { startBrandappAnalytics } from "@reopt-ai/brandapp-sdk/analytics";
15
+ *
16
+ * const analytics = await startBrandappAnalytics(sdk);
17
+ * analytics?.pageView();
18
+ * analytics?.track("signup_clicked", { plan: "pro" });
19
+ * analytics?.identify(customerId); // profileId = studio Customer.id
20
+ * ```
21
+ */
22
+ /**
23
+ * Fetches the config and initialises the SDK. Returns `null` when analytics is
24
+ * not enabled for the brand (project not provisioned) — callers can `?.` every
25
+ * call and ship the same code either way.
26
+ */
27
+ async function startBrandappAnalytics(sdk, options = {}) {
28
+ const config = await sdk.analytics.getConfig(options.accessToken);
29
+ if (!config.enabled) return null;
30
+ if (!getInstance()) init({
31
+ baseUrl: config.baseUrl,
32
+ writeKey: config.writeKey
33
+ });
34
+ return {
35
+ track,
36
+ identify,
37
+ pageView,
38
+ setConsent
39
+ };
40
+ }
41
+
42
+ //#endregion
43
+ export { ReoptAnalyticsClient, createReoptAnalyticsClient, startBrandappAnalytics };
44
+ //# sourceMappingURL=index.js.map
@@ -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-D9MGqXbn.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-D31PK7eu.js";
2
- import { t as BaseHttpClient } from "../http-client-D1vuc20o.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-D1vuc20o.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-DUvf9x_b.js.map
83
+ //# sourceMappingURL=client-B_7XihyW.js.map
@@ -1,4 +1,4 @@
1
- import { t as BaseHttpClient } from "./http-client-D1vuc20o.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-2qKKpHVy.js.map
28
+ //# sourceMappingURL=client-C1zORyWz.js.map
@@ -0,0 +1,20 @@
1
+ import { t as BaseHttpClient } from "./http-client-Dw_U7Wgx.js";
2
+
3
+ //#region src/analytics/client.ts
4
+ var ReoptAnalyticsClient = class {
5
+ http;
6
+ constructor(config) {
7
+ this.http = new BaseHttpClient(config, `/api/v1/brandapp/${config.brandappId}/analytics`);
8
+ }
9
+ /** Basic or Bearer. `{ enabled: false }` until the brand's project is provisioned. */
10
+ async getConfig(accessToken) {
11
+ return (await this.http.fetch("GET", "/config", void 0, accessToken ? { bearerToken: accessToken } : void 0)).data;
12
+ }
13
+ };
14
+ function createReoptAnalyticsClient(config) {
15
+ return new ReoptAnalyticsClient(config);
16
+ }
17
+
18
+ //#endregion
19
+ export { createReoptAnalyticsClient as n, ReoptAnalyticsClient as t };
20
+ //# sourceMappingURL=client-C3hlUyaZ.js.map
@@ -1,5 +1,5 @@
1
- import { t as BaseHttpClient } from "./http-client-D1vuc20o.js";
2
- import { t as buildQuery } from "./query-DyiwJX92.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-B0uRUF3T.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-D1vuc20o.js";
2
- import { t as buildQuery } from "./query-DyiwJX92.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-CAjqKz8i.js.map
503
+ //# sourceMappingURL=client-ClX0it9Z.js.map
@@ -0,0 +1,24 @@
1
+ import { n as ReoptSDKConfig } from "./config-D28P8iwm.js";
2
+ //#region src/analytics/types.d.ts
3
+ /** `GET /brandapp/{id}/analytics/config` — 브랜드의 reopt-data 브라우저 수집 설정. */
4
+ type AnalyticsConfig = {
5
+ enabled: false;
6
+ } | {
7
+ enabled: true;
8
+ /** reopt-data base URL — data-sdk `init({ baseUrl })`에 그대로. */
9
+ baseUrl: string;
10
+ /** 브라우저 수집 키(scopes ingest). 공개 값 — 읽기 권한이 없다. */
11
+ writeKey: string;
12
+ };
13
+ //#endregion
14
+ //#region src/analytics/client.d.ts
15
+ declare class ReoptAnalyticsClient {
16
+ private readonly http;
17
+ constructor(config: ReoptSDKConfig);
18
+ /** Basic or Bearer. `{ enabled: false }` until the brand's project is provisioned. */
19
+ getConfig(accessToken?: string): Promise<AnalyticsConfig>;
20
+ }
21
+ declare function createReoptAnalyticsClient(config: ReoptSDKConfig): ReoptAnalyticsClient;
22
+ //#endregion
23
+ export { createReoptAnalyticsClient as n, AnalyticsConfig as r, ReoptAnalyticsClient as t };
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-D31PK7eu.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-D1vuc20o.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.0.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-D72MLGRY.js.map
305
+ //# sourceMappingURL=client-DR5Eb36i.js.map
@@ -1,4 +1,4 @@
1
- import { t as BaseHttpClient } from "./http-client-D1vuc20o.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-DTWpLo8X.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-D1vuc20o.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-Djlg4STl.js.map
81
+ //# sourceMappingURL=client-Dd1QpCUq.js.map
@@ -1,4 +1,4 @@
1
- import { t as BaseHttpClient } from "./http-client-D1vuc20o.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-D9MGqXbn.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-D31PK7eu.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-D1vuc20o.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-C6USfykM.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-B0uRUF3T.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.0.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-D31PK7eu.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