@reopt-ai/brandapp-sdk 3.3.0 → 3.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/CHANGELOG.md +67 -0
  2. package/README.md +10 -1
  3. package/dist/abort--nOBFN4M.js +50 -0
  4. package/dist/ai/index.d.ts +2 -314
  5. package/dist/ai/index.js +3 -8
  6. package/dist/ai-provider/index.d.ts +79 -163
  7. package/dist/ai-provider/index.js +752 -685
  8. package/dist/auth/index.d.ts +27 -27
  9. package/dist/auth/index.js +41 -34
  10. package/dist/better-auth/client.d.ts +6 -5
  11. package/dist/better-auth/client.js +28 -5
  12. package/dist/better-auth/index.d.ts +19 -17
  13. package/dist/better-auth/index.js +180 -144
  14. package/dist/client-B1q5P8rv.js +83 -0
  15. package/dist/client-B9QHVhdM.js +77 -0
  16. package/dist/client-BGGd_cpV.d.ts +103 -0
  17. package/dist/client-BJcy1V1a.js +140 -0
  18. package/dist/client-Beivhucf.js +55 -0
  19. package/dist/client-BruP5_nU.d.ts +147 -0
  20. package/dist/client-D-yNxNfk.js +28 -0
  21. package/dist/client-D0eBxh8j.d.ts +284 -0
  22. package/dist/client-D3RHHUUW.d.ts +207 -0
  23. package/dist/client-D6gs61w8.d.ts +53 -0
  24. package/dist/client-DBnK7ooQ.js +86 -0
  25. package/dist/client-DDw5yz_h.d.ts +53 -0
  26. package/dist/client-DPmoKuR9.js +305 -0
  27. package/dist/client-DsdakibF.js +503 -0
  28. package/dist/client-Dxg8_DIH.d.ts +71 -0
  29. package/dist/client-EbhUIhHq.js +53 -0
  30. package/dist/client-lk6wBu_0.d.ts +48 -0
  31. package/dist/client-p49ol9pg.d.ts +124 -0
  32. package/dist/cms/index.d.ts +52 -108
  33. package/dist/cms/index.js +103 -86
  34. package/dist/config-CRytOPPl.d.ts +394 -0
  35. package/dist/config-Cw0a3-C8.js +487 -0
  36. package/dist/dev/index.d.ts +2 -528
  37. package/dist/dev/index.js +2731 -2967
  38. package/dist/eav/coerce.d.ts +3 -1
  39. package/dist/eav/coerce.js +72 -46
  40. package/dist/eav/index.d.ts +72 -100
  41. package/dist/eav/index.js +158 -126
  42. package/dist/eav/migrate.d.ts +112 -109
  43. package/dist/eav/migrate.js +230 -196
  44. package/dist/eav/schema.d.ts +111 -150
  45. package/dist/eav/schema.js +624 -603
  46. package/dist/encoding-Bwfm3iaE.js +21 -0
  47. package/dist/{errors-BjDFIyA6.d.ts → errors-CRCcErNC.d.ts} +55 -53
  48. package/dist/feedback/index.d.ts +2 -132
  49. package/dist/feedback/index.js +3 -6
  50. package/dist/files/index.d.ts +14 -14
  51. package/dist/files/index.js +41 -25
  52. package/dist/http-client-QKUvvirs.js +386 -0
  53. package/dist/index-DrVaKfhs.d.ts +456 -0
  54. package/dist/index-Z6OGcurJ.d.ts +169 -0
  55. package/dist/index.d.ts +6 -230
  56. package/dist/index.js +119 -71
  57. package/dist/logout/index.d.ts +56 -53
  58. package/dist/logout/index.js +232 -289
  59. package/dist/plans/index.d.ts +2 -236
  60. package/dist/plans/index.js +3 -6
  61. package/dist/push/index.d.ts +2 -79
  62. package/dist/push/index.js +3 -6
  63. package/dist/query-BvbCiGWb.js +35 -0
  64. package/dist/react/hooks.d.ts +97 -99
  65. package/dist/react/hooks.js +742 -404
  66. package/dist/sse-parser-FMjxM7sY.js +86 -0
  67. package/dist/terms/index.d.ts +3 -79
  68. package/dist/terms/index.js +3 -6
  69. package/dist/testing/index.d.ts +52 -104
  70. package/dist/testing/index.js +94 -72
  71. package/dist/types-B-SMkH6s.d.ts +26 -0
  72. package/dist/types-BXDcoJHG.d.ts +131 -0
  73. package/dist/types-BrghN2rJ.d.ts +105 -0
  74. package/dist/types-DjDRszNj.js +11 -0
  75. package/dist/webhooks/index.d.ts +77 -50
  76. package/dist/webhooks/index.js +150 -127
  77. package/docs/api-reference.md +87 -6
  78. package/package.json +6 -5
  79. package/dist/chunk-2LSCQHAU.js +0 -21
  80. package/dist/chunk-4U4ZPPL4.js +0 -599
  81. package/dist/chunk-55KHY5GH.js +0 -96
  82. package/dist/chunk-C5VTRZWX.js +0 -458
  83. package/dist/chunk-F7BXBTZI.js +0 -54
  84. package/dist/chunk-FJUCWXX3.js +0 -350
  85. package/dist/chunk-H33OTQEN.js +0 -112
  86. package/dist/chunk-L4DHB36G.js +0 -75
  87. package/dist/chunk-OG7R3UAR.js +0 -105
  88. package/dist/chunk-PF24XU54.js +0 -32
  89. package/dist/chunk-QN3QD67K.js +0 -49
  90. package/dist/chunk-REIKXSMY.js +0 -7
  91. package/dist/chunk-UGBBXCZE.js +0 -157
  92. package/dist/chunk-UVT2E6KD.js +0 -81
  93. package/dist/chunk-YPLT3RFL.js +0 -63
  94. package/dist/chunk-YTKSAWV2.js +0 -463
  95. package/dist/client-BkcO-0C2.d.ts +0 -216
  96. package/dist/client-CN5_tNOC.d.ts +0 -147
  97. package/dist/client-DttyeM_h.d.ts +0 -102
  98. package/dist/config-CtxyJsDR.d.ts +0 -397
  99. package/dist/typed-client-BxOVIiMU.d.ts +0 -40
  100. package/dist/types-6E3ZLL9X.d.ts +0 -24
  101. package/dist/types-DskYLVb8.d.ts +0 -104
  102. package/dist/types-ckmDDW3N.d.ts +0 -129
@@ -1,64 +1,63 @@
1
- import { A as AttributeDef, p as EntityDef, S as SchemaDef, l as EavEntity, E as EavAttribute, k as EavDataType } from '../config-CtxyJsDR.js';
2
- export { I as InferValues } from '../config-CtxyJsDR.js';
3
- import { R as ReoptEavClient } from '../client-BkcO-0C2.js';
4
- import '../typed-client-BxOVIiMU.js';
5
-
1
+ import { C as EavEntity, S as EavDataType, b as EavAttribute, c as InferValues, l as SchemaDef, o as AttributeDef, s as EntityDef } from "../config-CRytOPPl.js";
2
+ import { t as ReoptEavClient } from "../client-BGGd_cpV.js";
3
+ //#region src/eav/schema/define.d.ts
6
4
  declare function defineEntity<const A extends Record<string, AttributeDef>>(def: EntityDef<A>): EntityDef<A>;
7
5
  declare function defineSchema<const E extends Record<string, EntityDef>>(def: SchemaDef<E>): SchemaDef<E>;
8
-
6
+ //#endregion
7
+ //#region src/eav/schema/diff.d.ts
9
8
  type AttributeAction = {
10
- type: "create";
11
- name: string;
12
- def: AttributeDef;
9
+ type: "create";
10
+ name: string;
11
+ def: AttributeDef;
13
12
  } | {
14
- type: "update";
15
- name: string;
16
- attributeId: string;
17
- changes: Record<string, unknown>;
18
- oldValues: Record<string, unknown>;
13
+ type: "update";
14
+ name: string;
15
+ attributeId: string;
16
+ changes: Record<string, unknown>;
17
+ oldValues: Record<string, unknown>;
19
18
  } | {
20
- type: "delete";
21
- name: string;
22
- attributeId: string;
19
+ type: "delete";
20
+ name: string;
21
+ attributeId: string;
23
22
  } | {
24
- type: "unchanged";
25
- name: string;
26
- attributeId: string;
23
+ type: "unchanged";
24
+ name: string;
25
+ attributeId: string;
27
26
  };
28
27
  type EntityAction = {
29
- type: "create";
30
- key: string;
31
- def: EntityDef;
32
- attributes: AttributeAction[];
28
+ type: "create";
29
+ key: string;
30
+ def: EntityDef;
31
+ attributes: AttributeAction[];
33
32
  } | {
34
- type: "update";
35
- key: string;
36
- entityId: string;
37
- changes: Record<string, unknown>;
38
- attributes: AttributeAction[];
33
+ type: "update";
34
+ key: string;
35
+ entityId: string;
36
+ changes: Record<string, unknown>;
37
+ attributes: AttributeAction[];
39
38
  } | {
40
- type: "unchanged";
41
- key: string;
42
- entityId: string;
43
- attributes: AttributeAction[];
39
+ type: "unchanged";
40
+ key: string;
41
+ entityId: string;
42
+ attributes: AttributeAction[];
44
43
  } | {
45
- type: "delete";
46
- key: string;
47
- entityId: string;
44
+ type: "delete";
45
+ key: string;
46
+ entityId: string;
48
47
  };
49
48
  type DiffResult = {
50
- entities: EntityAction[];
51
- hasChanges: boolean;
49
+ entities: EntityAction[];
50
+ hasChanges: boolean;
52
51
  };
53
52
  /** Lockfile entity/attribute ID mappings for stable matching across renames */
54
53
  type LockfileData = {
55
- entities: Record<string, {
56
- id: string;
57
- attributes: Record<string, string>;
58
- }>;
54
+ entities: Record<string, {
55
+ id: string;
56
+ attributes: Record<string, string>;
57
+ }>;
59
58
  };
60
59
  type ServerEntity = EavEntity & {
61
- attributes: EavAttribute[];
60
+ attributes: EavAttribute[];
62
61
  };
63
62
  /**
64
63
  * Compute diff between a local schema definition and server entities.
@@ -69,47 +68,28 @@ type ServerEntity = EavEntity & {
69
68
  * @param options.lockfile - Lockfile data for stable ID-based matching
70
69
  */
71
70
  declare function computeDiff(schema: SchemaDef, serverEntities: ServerEntity[], options?: {
72
- deleteOrphans?: boolean;
73
- lockfile?: LockfileData | null;
71
+ deleteOrphans?: boolean;
72
+ lockfile?: LockfileData | null;
74
73
  }): DiffResult;
75
-
76
- /**
77
- * SchemaDef → JSON Schema 변환
78
- *
79
- * EAV 스키마 정의를 표준 JSON Schema (draft-07)로 변환합니다.
80
- * AI structured output, 폼 빌더, 밸리데이터 등에서 활용 가능.
81
- *
82
- * @example
83
- * ```ts
84
- * import { defineSchema, defineEntity } from "@reopt-ai/brandapp-sdk/eav/schema";
85
- * import { schemaToJsonSchema, entityToJsonSchema } from "@reopt-ai/brandapp-sdk/eav/schema";
86
- *
87
- * const schema = defineSchema({ entities: { contacts } });
88
- * const jsonSchema = schemaToJsonSchema(schema);
89
- * // → { type: "object", properties: { contacts: { ... } } }
90
- *
91
- * const contactsSchema = entityToJsonSchema(contacts);
92
- * // → { type: "object", properties: { name: { type: "string" }, ... }, required: ["name"] }
93
- * ```
94
- */
95
-
74
+ //#endregion
75
+ //#region src/eav/schema/json-schema.d.ts
96
76
  type JSONSchema7 = {
97
- $schema?: string;
98
- title?: string;
99
- description?: string;
100
- type?: string;
101
- properties?: Record<string, JSONSchema7>;
102
- required?: string[];
103
- items?: JSONSchema7;
104
- enum?: unknown[];
105
- format?: string;
106
- minimum?: number;
107
- maximum?: number;
108
- minLength?: number;
109
- maxLength?: number;
110
- pattern?: string;
111
- default?: unknown;
112
- [key: string]: unknown;
77
+ $schema?: string;
78
+ title?: string;
79
+ description?: string;
80
+ type?: string;
81
+ properties?: Record<string, JSONSchema7>;
82
+ required?: string[];
83
+ items?: JSONSchema7;
84
+ enum?: unknown[];
85
+ format?: string;
86
+ minimum?: number;
87
+ maximum?: number;
88
+ minLength?: number;
89
+ maxLength?: number;
90
+ pattern?: string;
91
+ default?: unknown;
92
+ [key: string]: unknown;
113
93
  };
114
94
  /**
115
95
  * 단일 엔티티를 JSON Schema로 변환
@@ -121,28 +101,8 @@ declare function entityToJsonSchema(entity: EntityDef): JSONSchema7;
121
101
  * 각 엔티티가 properties의 키로 들어갑니다.
122
102
  */
123
103
  declare function schemaToJsonSchema(schema: SchemaDef): JSONSchema7;
124
-
125
- /**
126
- * dataType compatibility matrix.
127
- *
128
- * Used by the safety classifier to decide whether a dataType change is
129
- * destructive (data loss likely) or merely a warning (storage column stays
130
- * the same, only validation rules change).
131
- *
132
- * The matrix is intentionally conservative — only conversions that share
133
- * the same underlying server storage column AND whose semantics relax
134
- * (not tighten) are listed here. Anything tightening validation
135
- * (string → email, string → number, etc.) stays destructive because
136
- * existing rows can fail the new check.
137
- *
138
- * Storage notes (server side):
139
- * - string / textarea / email / url / select → textValue
140
- * - multiselect → textValue (JSON array)
141
- * - number → numericValue
142
- * - boolean → booleanValue
143
- * - date → dateValue
144
- */
145
-
104
+ //#endregion
105
+ //#region src/eav/schema/compatibility.d.ts
146
106
  /**
147
107
  * Returns `true` when the dataType change preserves the existing values
148
108
  * without server-side conversion or validation rejection.
@@ -150,20 +110,19 @@ declare function schemaToJsonSchema(schema: SchemaDef): JSONSchema7;
150
110
  * Identity (`from === to`) is treated as compatible.
151
111
  */
152
112
  declare function isCompatibleDataTypeChange(from: EavDataType, to: EavDataType): boolean;
153
-
154
113
  type CompatibilitySeverity = "warning" | "destructive";
155
114
  type CompatibilityIssue = {
156
- severity: CompatibilitySeverity;
157
- /** Entity key from the schema (or server name when deleting). */
158
- entityKey: string;
159
- /** Attribute name when the issue is attribute-scoped. */
160
- attributeName?: string;
161
- /** Short machine-readable code (e.g. "ENTITY_DELETE", "INCOMPATIBLE_DATATYPE"). */
162
- code: string;
163
- /** Human-readable explanation. */
164
- message: string;
165
- /** Suggested mitigation. */
166
- fix: string;
115
+ severity: CompatibilitySeverity;
116
+ /** Entity key from the schema (or server name when deleting). */
117
+ entityKey: string;
118
+ /** Attribute name when the issue is attribute-scoped. */
119
+ attributeName?: string;
120
+ /** Short machine-readable code (e.g. "ENTITY_DELETE", "INCOMPATIBLE_DATATYPE"). */
121
+ code: string;
122
+ /** Human-readable explanation. */
123
+ message: string;
124
+ /** Suggested mitigation. */
125
+ fix: string;
167
126
  };
168
127
  /**
169
128
  * Inspect a {@link DiffResult} and return every change that risks data loss
@@ -177,25 +136,26 @@ type CompatibilityIssue = {
177
136
  * rows may have stored a now-unknown enum value).
178
137
  */
179
138
  declare function assessCompatibility(diff: DiffResult): CompatibilityIssue[];
180
-
139
+ //#endregion
140
+ //#region src/eav/schema/sync.d.ts
181
141
  type SyncedEntity = {
182
- key: string;
183
- entityId: string;
184
- attributes: SyncedAttribute[];
142
+ key: string;
143
+ entityId: string;
144
+ attributes: SyncedAttribute[];
185
145
  };
186
146
  type SyncedAttribute = {
187
- name: string;
188
- attributeId: string;
147
+ name: string;
148
+ attributeId: string;
189
149
  };
190
150
  type SyncResult = {
191
- entities: SyncedEntity[];
192
- errors: SyncError[];
193
- /**
194
- * Compatibility issues detected before applying the diff. Always populated
195
- * — both `warning` (informational) and `destructive` (blocked unless
196
- * `allowDestructive: true`) entries appear here.
197
- */
198
- warnings: CompatibilityIssue[];
151
+ entities: SyncedEntity[];
152
+ errors: SyncError[];
153
+ /**
154
+ * Compatibility issues detected before applying the diff. Always populated
155
+ * — both `warning` (informational) and `destructive` (blocked unless
156
+ * `allowDestructive: true`) entries appear here.
157
+ */
158
+ warnings: CompatibilityIssue[];
199
159
  };
200
160
  /**
201
161
  * Thrown by {@link syncSchema} when the diff contains destructive changes
@@ -203,30 +163,30 @@ type SyncResult = {
203
163
  * full list of risks; pass `allowDestructive: true` to override.
204
164
  */
205
165
  declare class SchemaCompatibilityError extends Error {
206
- readonly issues: CompatibilityIssue[];
207
- constructor(issues: CompatibilityIssue[]);
166
+ readonly issues: CompatibilityIssue[];
167
+ constructor(issues: CompatibilityIssue[]);
208
168
  }
209
169
  type SyncError = {
210
- key: string;
211
- message: string;
170
+ key: string;
171
+ message: string;
212
172
  };
213
173
  type SyncProgressEvent = {
214
- type: "created" | "updated" | "deleted" | "unchanged" | "error";
215
- key: string;
216
- detail: string;
174
+ type: "created" | "updated" | "deleted" | "unchanged" | "error";
175
+ key: string;
176
+ detail: string;
217
177
  };
218
178
  type SyncOptions = {
219
- deleteOrphans?: boolean;
220
- lockfile?: LockfileData | null;
221
- onProgress?: (event: SyncProgressEvent) => void;
222
- /**
223
- * Allow destructive changes (entity/attribute deletions, incompatible
224
- * dataType migrations, optional → required, non-unique → unique). When
225
- * false (default), `syncSchema` throws {@link SchemaCompatibilityError}
226
- * before touching the server; when true, the changes apply unchecked
227
- * but the issues still appear in `result.warnings`.
228
- */
229
- allowDestructive?: boolean;
179
+ deleteOrphans?: boolean;
180
+ lockfile?: LockfileData | null;
181
+ onProgress?: (event: SyncProgressEvent) => void;
182
+ /**
183
+ * Allow destructive changes (entity/attribute deletions, incompatible
184
+ * dataType migrations, optional → required, non-unique → unique). When
185
+ * false (default), `syncSchema` throws {@link SchemaCompatibilityError}
186
+ * before touching the server; when true, the changes apply unchecked
187
+ * but the issues still appear in `result.warnings`.
188
+ */
189
+ allowDestructive?: boolean;
230
190
  };
231
191
  /**
232
192
  * Apply a diff result to the server — execute creates, updates, and deletes.
@@ -256,5 +216,6 @@ declare function applySync(eav: ReoptEavClient, diff: DiffResult, onProgress?: S
256
216
  * ```
257
217
  */
258
218
  declare function syncSchema(eav: ReoptEavClient, schema: SchemaDef, options?: SyncOptions): Promise<SyncResult>;
259
-
260
- export { type AttributeAction, AttributeDef, type CompatibilityIssue, type CompatibilitySeverity, type DiffResult, type EntityAction, EntityDef, type LockfileData, SchemaCompatibilityError, SchemaDef, type SyncError, type SyncOptions, type SyncProgressEvent, type SyncResult, type SyncedAttribute, type SyncedEntity, applySync, assessCompatibility, computeDiff, defineEntity, defineSchema, entityToJsonSchema, isCompatibleDataTypeChange, schemaToJsonSchema, syncSchema };
219
+ //#endregion
220
+ export { type AttributeAction, type AttributeDef, type CompatibilityIssue, type CompatibilitySeverity, type DiffResult, type EntityAction, type EntityDef, type InferValues, type LockfileData, SchemaCompatibilityError, type SchemaDef, type SyncError, type SyncOptions, type SyncProgressEvent, type SyncResult, type SyncedAttribute, type SyncedEntity, applySync, assessCompatibility, computeDiff, defineEntity, defineSchema, entityToJsonSchema, isCompatibleDataTypeChange, schemaToJsonSchema, syncSchema };
221
+ //# sourceMappingURL=schema.d.ts.map