@reopt-ai/brandapp-sdk 3.3.0 → 3.5.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 +115 -0
- package/README.md +10 -1
- package/dist/abort--nOBFN4M.js +50 -0
- package/dist/ai/index.d.ts +2 -314
- package/dist/ai/index.js +3 -8
- package/dist/ai-provider/index.d.ts +79 -163
- package/dist/ai-provider/index.js +752 -685
- package/dist/auth/index.d.ts +27 -27
- package/dist/auth/index.js +41 -34
- package/dist/better-auth/client.d.ts +6 -5
- package/dist/better-auth/client.js +28 -5
- package/dist/better-auth/index.d.ts +19 -17
- package/dist/better-auth/index.js +180 -144
- package/dist/client-61ldOHMz.js +503 -0
- package/dist/client-7PCoxVhZ.js +28 -0
- package/dist/client-B7rZQ8Zi.d.ts +272 -0
- package/dist/client-BGGd_cpV.d.ts +103 -0
- package/dist/client-BoIuyx4S.js +273 -0
- package/dist/client-BruP5_nU.d.ts +147 -0
- package/dist/client-BxtZt405.js +305 -0
- package/dist/client-ByN3EQdk.js +83 -0
- package/dist/client-CAghoGD_.js +53 -0
- package/dist/client-C_pHsPlj.js +81 -0
- package/dist/client-D0eBxh8j.d.ts +284 -0
- package/dist/client-D6gs61w8.d.ts +53 -0
- package/dist/client-DDw5yz_h.d.ts +53 -0
- package/dist/client-Dxg8_DIH.d.ts +71 -0
- package/dist/client-aMR4CRB8.d.ts +211 -0
- package/dist/client-lk6wBu_0.d.ts +48 -0
- package/dist/client-wEVKLdly.js +55 -0
- package/dist/client-zF1RG2uA.js +86 -0
- package/dist/cms/index.d.ts +52 -108
- package/dist/cms/index.js +103 -86
- package/dist/config-CRytOPPl.d.ts +394 -0
- package/dist/config-aml9oQpX.js +487 -0
- package/dist/dev/index.d.ts +2 -528
- package/dist/dev/index.js +3047 -2967
- package/dist/eav/coerce.d.ts +3 -1
- package/dist/eav/coerce.js +72 -46
- package/dist/eav/index.d.ts +72 -100
- package/dist/eav/index.js +158 -126
- package/dist/eav/migrate.d.ts +112 -109
- package/dist/eav/migrate.js +230 -196
- package/dist/eav/schema.d.ts +111 -150
- package/dist/eav/schema.js +624 -603
- package/dist/encoding-Bwfm3iaE.js +21 -0
- package/dist/{errors-BjDFIyA6.d.ts → errors-CRCcErNC.d.ts} +55 -53
- package/dist/feedback/index.d.ts +2 -132
- package/dist/feedback/index.js +3 -6
- package/dist/files/index.d.ts +14 -14
- package/dist/files/index.js +41 -25
- package/dist/http-client-BZc2mngq.js +386 -0
- package/dist/index-1j_738qk.d.ts +470 -0
- package/dist/index-CeOLGdyL.d.ts +169 -0
- package/dist/index.d.ts +6 -230
- package/dist/index.js +119 -71
- package/dist/logout/index.d.ts +56 -53
- package/dist/logout/index.js +232 -289
- package/dist/plans/index.d.ts +2 -236
- package/dist/plans/index.js +3 -6
- package/dist/push/index.d.ts +2 -79
- package/dist/push/index.js +3 -6
- package/dist/query-xWqtfkvR.js +35 -0
- package/dist/react/hooks.d.ts +157 -100
- package/dist/react/hooks.js +862 -406
- package/dist/sse-parser-FMjxM7sY.js +86 -0
- package/dist/terms/index.d.ts +3 -79
- package/dist/terms/index.js +3 -6
- package/dist/testing/index.d.ts +52 -104
- package/dist/testing/index.js +94 -72
- package/dist/types-B-SMkH6s.d.ts +26 -0
- package/dist/types-BXDcoJHG.d.ts +131 -0
- package/dist/types-BrghN2rJ.d.ts +105 -0
- package/dist/types-DjDRszNj.js +11 -0
- package/dist/webhooks/index.d.ts +77 -50
- package/dist/webhooks/index.js +150 -127
- package/docs/api-reference.md +121 -8
- package/docs/errors.md +19 -0
- package/docs/files.md +165 -7
- package/package.json +7 -6
- package/dist/chunk-2LSCQHAU.js +0 -21
- package/dist/chunk-4U4ZPPL4.js +0 -599
- package/dist/chunk-55KHY5GH.js +0 -96
- package/dist/chunk-C5VTRZWX.js +0 -458
- package/dist/chunk-F7BXBTZI.js +0 -54
- package/dist/chunk-FJUCWXX3.js +0 -350
- package/dist/chunk-H33OTQEN.js +0 -112
- package/dist/chunk-L4DHB36G.js +0 -75
- package/dist/chunk-OG7R3UAR.js +0 -105
- package/dist/chunk-PF24XU54.js +0 -32
- package/dist/chunk-QN3QD67K.js +0 -49
- package/dist/chunk-REIKXSMY.js +0 -7
- package/dist/chunk-UGBBXCZE.js +0 -157
- package/dist/chunk-UVT2E6KD.js +0 -81
- package/dist/chunk-YPLT3RFL.js +0 -63
- package/dist/chunk-YTKSAWV2.js +0 -463
- package/dist/client-BkcO-0C2.d.ts +0 -216
- package/dist/client-CN5_tNOC.d.ts +0 -147
- package/dist/client-DttyeM_h.d.ts +0 -102
- package/dist/config-CtxyJsDR.d.ts +0 -397
- package/dist/typed-client-BxOVIiMU.d.ts +0 -40
- package/dist/types-6E3ZLL9X.d.ts +0 -24
- package/dist/types-DskYLVb8.d.ts +0 -104
- package/dist/types-ckmDDW3N.d.ts +0 -129
package/dist/eav/schema.d.ts
CHANGED
|
@@ -1,64 +1,63 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
type: "create";
|
|
10
|
+
name: string;
|
|
11
|
+
def: AttributeDef;
|
|
13
12
|
} | {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
type: "update";
|
|
14
|
+
name: string;
|
|
15
|
+
attributeId: string;
|
|
16
|
+
changes: Record<string, unknown>;
|
|
17
|
+
oldValues: Record<string, unknown>;
|
|
19
18
|
} | {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
type: "delete";
|
|
20
|
+
name: string;
|
|
21
|
+
attributeId: string;
|
|
23
22
|
} | {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
type: "unchanged";
|
|
24
|
+
name: string;
|
|
25
|
+
attributeId: string;
|
|
27
26
|
};
|
|
28
27
|
type EntityAction = {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
type: "create";
|
|
29
|
+
key: string;
|
|
30
|
+
def: EntityDef;
|
|
31
|
+
attributes: AttributeAction[];
|
|
33
32
|
} | {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
type: "update";
|
|
34
|
+
key: string;
|
|
35
|
+
entityId: string;
|
|
36
|
+
changes: Record<string, unknown>;
|
|
37
|
+
attributes: AttributeAction[];
|
|
39
38
|
} | {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
type: "unchanged";
|
|
40
|
+
key: string;
|
|
41
|
+
entityId: string;
|
|
42
|
+
attributes: AttributeAction[];
|
|
44
43
|
} | {
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
type: "delete";
|
|
45
|
+
key: string;
|
|
46
|
+
entityId: string;
|
|
48
47
|
};
|
|
49
48
|
type DiffResult = {
|
|
50
|
-
|
|
51
|
-
|
|
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
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
entities: Record<string, {
|
|
55
|
+
id: string;
|
|
56
|
+
attributes: Record<string, string>;
|
|
57
|
+
}>;
|
|
59
58
|
};
|
|
60
59
|
type ServerEntity = EavEntity & {
|
|
61
|
-
|
|
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
|
-
|
|
73
|
-
|
|
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
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
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
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
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
|
-
|
|
183
|
-
|
|
184
|
-
|
|
142
|
+
key: string;
|
|
143
|
+
entityId: string;
|
|
144
|
+
attributes: SyncedAttribute[];
|
|
185
145
|
};
|
|
186
146
|
type SyncedAttribute = {
|
|
187
|
-
|
|
188
|
-
|
|
147
|
+
name: string;
|
|
148
|
+
attributeId: string;
|
|
189
149
|
};
|
|
190
150
|
type SyncResult = {
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
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
|
-
|
|
207
|
-
|
|
166
|
+
readonly issues: CompatibilityIssue[];
|
|
167
|
+
constructor(issues: CompatibilityIssue[]);
|
|
208
168
|
}
|
|
209
169
|
type SyncError = {
|
|
210
|
-
|
|
211
|
-
|
|
170
|
+
key: string;
|
|
171
|
+
message: string;
|
|
212
172
|
};
|
|
213
173
|
type SyncProgressEvent = {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
174
|
+
type: "created" | "updated" | "deleted" | "unchanged" | "error";
|
|
175
|
+
key: string;
|
|
176
|
+
detail: string;
|
|
217
177
|
};
|
|
218
178
|
type SyncOptions = {
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
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
|