@reopt-ai/brandapp-sdk 3.1.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.
- package/CHANGELOG.md +147 -0
- package/README.md +39 -14
- package/dist/abort--nOBFN4M.js +50 -0
- package/dist/ai/index.d.ts +2 -314
- package/dist/ai/index.js +3 -7
- package/dist/ai-provider/index.d.ts +79 -163
- package/dist/ai-provider/index.js +752 -671
- package/dist/auth/index.d.ts +27 -27
- package/dist/auth/index.js +41 -33
- 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 -133
- package/dist/client-B1q5P8rv.js +83 -0
- package/dist/client-B9QHVhdM.js +77 -0
- package/dist/client-BGGd_cpV.d.ts +103 -0
- package/dist/client-BJcy1V1a.js +140 -0
- package/dist/client-Beivhucf.js +55 -0
- package/dist/client-BruP5_nU.d.ts +147 -0
- package/dist/client-D-yNxNfk.js +28 -0
- package/dist/client-D0eBxh8j.d.ts +284 -0
- package/dist/client-D3RHHUUW.d.ts +207 -0
- package/dist/client-D6gs61w8.d.ts +53 -0
- package/dist/client-DBnK7ooQ.js +86 -0
- package/dist/client-DDw5yz_h.d.ts +53 -0
- package/dist/client-DPmoKuR9.js +305 -0
- package/dist/client-DsdakibF.js +503 -0
- package/dist/client-Dxg8_DIH.d.ts +71 -0
- package/dist/client-EbhUIhHq.js +53 -0
- package/dist/client-lk6wBu_0.d.ts +48 -0
- package/dist/client-p49ol9pg.d.ts +124 -0
- package/dist/cms/index.d.ts +52 -108
- package/dist/cms/index.js +105 -84
- package/dist/config-CRytOPPl.d.ts +394 -0
- package/dist/config-Cw0a3-C8.js +487 -0
- package/dist/dev/index.d.ts +2 -509
- package/dist/dev/index.js +2740 -2873
- 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 -125
- 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-DIAS8Rsl.d.ts → errors-CRCcErNC.d.ts} +55 -53
- package/dist/feedback/index.d.ts +2 -132
- package/dist/feedback/index.js +3 -5
- package/dist/files/index.d.ts +14 -14
- package/dist/files/index.js +41 -24
- package/dist/http-client-QKUvvirs.js +386 -0
- package/dist/index-DrVaKfhs.d.ts +456 -0
- package/dist/index-Z6OGcurJ.d.ts +169 -0
- package/dist/index.d.ts +6 -221
- package/dist/index.js +119 -70
- package/dist/logout/index.d.ts +109 -0
- package/dist/logout/index.js +264 -0
- package/dist/plans/index.d.ts +2 -236
- package/dist/plans/index.js +3 -5
- package/dist/push/index.d.ts +2 -79
- package/dist/push/index.js +3 -5
- package/dist/query-BvbCiGWb.js +35 -0
- package/dist/react/hooks.d.ts +97 -95
- package/dist/react/hooks.js +742 -356
- package/dist/sse-parser-FMjxM7sY.js +86 -0
- package/dist/terms/index.d.ts +3 -79
- package/dist/terms/index.js +3 -5
- 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 -47
- package/dist/webhooks/index.js +150 -127
- package/docs/api-reference.md +179 -2
- package/docs/dev-server.md +19 -18
- package/docs/errors.md +72 -15
- package/docs/logout.md +166 -0
- package/package.json +10 -5
- package/dist/chunk-2Q654O63.js +0 -350
- package/dist/chunk-F7BXBTZI.js +0 -54
- package/dist/chunk-IJOXTBIE.js +0 -599
- package/dist/chunk-JWXUVQRC.js +0 -157
- package/dist/chunk-L4DHB36G.js +0 -75
- package/dist/chunk-MRQY45U5.js +0 -465
- package/dist/chunk-N5JVE4WX.js +0 -449
- package/dist/chunk-O3PUWIDJ.js +0 -105
- package/dist/chunk-POLKEOYH.js +0 -63
- package/dist/chunk-R5CCGDUH.js +0 -49
- package/dist/chunk-RBHP7IZF.js +0 -96
- package/dist/chunk-REIKXSMY.js +0 -7
- package/dist/chunk-T7YTITRJ.js +0 -112
- package/dist/chunk-V73GORO3.js +0 -81
- package/dist/chunk-VRNBYSWU.js +0 -32
- 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/dev/index.d.ts
CHANGED
|
@@ -1,509 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* In-Memory Store for BrandApp Dev Server
|
|
6
|
-
*
|
|
7
|
-
* Map-based storage that mirrors the production Prisma models.
|
|
8
|
-
* Supports JSON serialization for persistence across restarts.
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
type DevEntity = {
|
|
12
|
-
id: string;
|
|
13
|
-
brandappId: string;
|
|
14
|
-
name: string;
|
|
15
|
-
description: string | null;
|
|
16
|
-
icon: string;
|
|
17
|
-
/** Host 분기. dev-server는 backend의 'brandapp' / 'brandappAuthUser'만 미러. */
|
|
18
|
-
linkedTo: "brandapp" | "brandappAuthUser";
|
|
19
|
-
maxRecords: number;
|
|
20
|
-
createdAt: Date;
|
|
21
|
-
updatedAt: Date;
|
|
22
|
-
};
|
|
23
|
-
type DevAttribute = {
|
|
24
|
-
id: string;
|
|
25
|
-
entityId: string;
|
|
26
|
-
name: string;
|
|
27
|
-
label: string;
|
|
28
|
-
dataType: string;
|
|
29
|
-
isRequired: boolean;
|
|
30
|
-
isUnique: boolean;
|
|
31
|
-
defaultValue: string | null;
|
|
32
|
-
validation: unknown | null;
|
|
33
|
-
options: unknown | null;
|
|
34
|
-
sortOrder: number;
|
|
35
|
-
createdAt: Date;
|
|
36
|
-
updatedAt: Date;
|
|
37
|
-
};
|
|
38
|
-
type DevValue = {
|
|
39
|
-
recordId: string;
|
|
40
|
-
attributeId: string;
|
|
41
|
-
value: string;
|
|
42
|
-
};
|
|
43
|
-
type DevRecord = {
|
|
44
|
-
id: string;
|
|
45
|
-
entityId: string;
|
|
46
|
-
brandappAuthUserId: string | null;
|
|
47
|
-
createdAt: Date;
|
|
48
|
-
updatedAt: Date;
|
|
49
|
-
values: DevValue[];
|
|
50
|
-
};
|
|
51
|
-
type DevAuthUser = {
|
|
52
|
-
id: string;
|
|
53
|
-
brandappId: string;
|
|
54
|
-
email: string;
|
|
55
|
-
emailVerified: boolean;
|
|
56
|
-
name: string | null;
|
|
57
|
-
image: string | null;
|
|
58
|
-
createdAt: Date;
|
|
59
|
-
updatedAt: Date;
|
|
60
|
-
};
|
|
61
|
-
type DevAuthSession = {
|
|
62
|
-
id: string;
|
|
63
|
-
userId: string;
|
|
64
|
-
brandappId: string;
|
|
65
|
-
token: string;
|
|
66
|
-
expiresAt: Date;
|
|
67
|
-
ipAddress: string | null;
|
|
68
|
-
userAgent: string | null;
|
|
69
|
-
createdAt: Date;
|
|
70
|
-
updatedAt: Date;
|
|
71
|
-
};
|
|
72
|
-
type DevAuthAccount = {
|
|
73
|
-
id: string;
|
|
74
|
-
userId: string;
|
|
75
|
-
brandappId: string;
|
|
76
|
-
providerId: string;
|
|
77
|
-
accountId: string;
|
|
78
|
-
accessToken: string | null;
|
|
79
|
-
refreshToken: string | null;
|
|
80
|
-
accessTokenExpiresAt: Date | null;
|
|
81
|
-
refreshTokenExpiresAt: Date | null;
|
|
82
|
-
idToken: string | null;
|
|
83
|
-
scope: string | null;
|
|
84
|
-
password: string | null;
|
|
85
|
-
createdAt: Date;
|
|
86
|
-
updatedAt: Date;
|
|
87
|
-
};
|
|
88
|
-
type DevAuthVerification = {
|
|
89
|
-
id: string;
|
|
90
|
-
brandappId: string;
|
|
91
|
-
identifier: string;
|
|
92
|
-
value: string;
|
|
93
|
-
expiresAt: Date;
|
|
94
|
-
createdAt: Date;
|
|
95
|
-
updatedAt: Date;
|
|
96
|
-
};
|
|
97
|
-
type DevFile = {
|
|
98
|
-
id: string;
|
|
99
|
-
brandappId: string;
|
|
100
|
-
name: string;
|
|
101
|
-
contentType: string;
|
|
102
|
-
size: number;
|
|
103
|
-
url: string;
|
|
104
|
-
createdAt: Date;
|
|
105
|
-
updatedAt: Date;
|
|
106
|
-
};
|
|
107
|
-
/**
|
|
108
|
-
* DevPost mirrors production `Post`/`PostDetail` shape so dev-server responses are
|
|
109
|
-
* indistinguishable from the remote API after the cms-handler maps them.
|
|
110
|
-
* Dates remain as `Date` objects in-memory and are stringified at the boundary.
|
|
111
|
-
*/
|
|
112
|
-
type DevPost = {
|
|
113
|
-
id: string;
|
|
114
|
-
brandappId: string;
|
|
115
|
-
slug: string;
|
|
116
|
-
title: string;
|
|
117
|
-
/** Plain-text content (검색용). */
|
|
118
|
-
content: string;
|
|
119
|
-
/** EditorSpec — opt-editor 호환 rich content. dev seeder가 MDX→EditorSpec 변환해서 넣음. */
|
|
120
|
-
contentRich: EditorSpec | null;
|
|
121
|
-
status: string;
|
|
122
|
-
groupId: string | null;
|
|
123
|
-
/** Publish 시각 (status='published' or 'scheduled'에서 의미 있음). */
|
|
124
|
-
publishedAt: Date | null;
|
|
125
|
-
/** Cover image (id + URL). dev에서는 외부 URL 또는 placeholder 권장. */
|
|
126
|
-
coverImage: {
|
|
127
|
-
id: string;
|
|
128
|
-
url: string | null;
|
|
129
|
-
} | null;
|
|
130
|
-
/** Author info. */
|
|
131
|
-
author: {
|
|
132
|
-
id: string;
|
|
133
|
-
name: string;
|
|
134
|
-
image: string | null;
|
|
135
|
-
};
|
|
136
|
-
/** Document icon (emoji 또는 URL). */
|
|
137
|
-
icon: string | null;
|
|
138
|
-
/** Tags as `{id, text}` references — production SDK Tag와 동일. */
|
|
139
|
-
tags: {
|
|
140
|
-
id: string;
|
|
141
|
-
text: string;
|
|
142
|
-
}[];
|
|
143
|
-
/** SEO meta. */
|
|
144
|
-
seo: {
|
|
145
|
-
metaTitle: string | null;
|
|
146
|
-
metaDescription: string | null;
|
|
147
|
-
metaKeywords: string | null;
|
|
148
|
-
};
|
|
149
|
-
createdAt: Date;
|
|
150
|
-
updatedAt: Date;
|
|
151
|
-
};
|
|
152
|
-
type DevPostGroup = {
|
|
153
|
-
id: string;
|
|
154
|
-
brandappId: string;
|
|
155
|
-
/** 브랜드 내 안정적 식별자 (production PostGroup.slug 미러). null 허용. */
|
|
156
|
-
slug: string | null;
|
|
157
|
-
name: string;
|
|
158
|
-
description: string | null;
|
|
159
|
-
color: string;
|
|
160
|
-
/** Brand reference (dev에서는 brandappId를 brand id로 사용해도 OK). */
|
|
161
|
-
brand: {
|
|
162
|
-
id: string;
|
|
163
|
-
name: string;
|
|
164
|
-
} | null;
|
|
165
|
-
createdAt: Date;
|
|
166
|
-
updatedAt: Date;
|
|
167
|
-
};
|
|
168
|
-
type DevTerms = {
|
|
169
|
-
id: string;
|
|
170
|
-
brandappId: string;
|
|
171
|
-
title: string;
|
|
172
|
-
type: "termsOfService" | "privacyPolicy" | "marketingConsent" | "custom";
|
|
173
|
-
jurisdiction: TermsJurisdiction;
|
|
174
|
-
isRequired: boolean;
|
|
175
|
-
isActive: boolean;
|
|
176
|
-
sortOrder: number;
|
|
177
|
-
createdAt: Date;
|
|
178
|
-
updatedAt: Date;
|
|
179
|
-
};
|
|
180
|
-
type DevTermsVersion = {
|
|
181
|
-
id: string;
|
|
182
|
-
termsId: string;
|
|
183
|
-
version: number;
|
|
184
|
-
locale: string;
|
|
185
|
-
content: string;
|
|
186
|
-
changeSummary: string | null;
|
|
187
|
-
publishedAt: Date;
|
|
188
|
-
isCurrent: boolean;
|
|
189
|
-
reConsentDeadline: Date | null;
|
|
190
|
-
createdAt: Date;
|
|
191
|
-
};
|
|
192
|
-
type DevTermsConsent = {
|
|
193
|
-
id: string;
|
|
194
|
-
versionId: string;
|
|
195
|
-
customerId: string;
|
|
196
|
-
status: "granted" | "withdrawn" | "pendingReConsent";
|
|
197
|
-
consentedAt: Date;
|
|
198
|
-
withdrawnAt: Date | null;
|
|
199
|
-
source: string | null;
|
|
200
|
-
ipAddress: string | null;
|
|
201
|
-
userAgent: string | null;
|
|
202
|
-
consentCountry: string | null;
|
|
203
|
-
consentLocale: string | null;
|
|
204
|
-
createdAt: Date;
|
|
205
|
-
};
|
|
206
|
-
type StoreSnapshot = {
|
|
207
|
-
entities: DevEntity[];
|
|
208
|
-
attributes: DevAttribute[];
|
|
209
|
-
records: DevRecord[];
|
|
210
|
-
authUsers: DevAuthUser[];
|
|
211
|
-
authSessions: DevAuthSession[];
|
|
212
|
-
authAccounts: DevAuthAccount[];
|
|
213
|
-
authVerifications: DevAuthVerification[];
|
|
214
|
-
files: DevFile[];
|
|
215
|
-
posts: DevPost[];
|
|
216
|
-
postGroups: DevPostGroup[];
|
|
217
|
-
terms: DevTerms[];
|
|
218
|
-
termsVersions: DevTermsVersion[];
|
|
219
|
-
termsConsents: DevTermsConsent[];
|
|
220
|
-
};
|
|
221
|
-
declare class InMemoryStore {
|
|
222
|
-
entities: Map<string, DevEntity>;
|
|
223
|
-
attributes: Map<string, DevAttribute>;
|
|
224
|
-
records: Map<string, DevRecord>;
|
|
225
|
-
authUsers: Map<string, DevAuthUser>;
|
|
226
|
-
authSessions: Map<string, DevAuthSession>;
|
|
227
|
-
authAccounts: Map<string, DevAuthAccount>;
|
|
228
|
-
authVerifications: Map<string, DevAuthVerification>;
|
|
229
|
-
files: Map<string, DevFile>;
|
|
230
|
-
posts: Map<string, DevPost>;
|
|
231
|
-
postGroups: Map<string, DevPostGroup>;
|
|
232
|
-
terms: Map<string, DevTerms>;
|
|
233
|
-
termsVersions: Map<string, DevTermsVersion>;
|
|
234
|
-
termsConsents: Map<string, DevTermsConsent>;
|
|
235
|
-
generateId(): string;
|
|
236
|
-
now(): Date;
|
|
237
|
-
findMany<T>(map: Map<string, T>, predicate: (item: T) => boolean): T[];
|
|
238
|
-
findFirst<T>(map: Map<string, T>, predicate: (item: T) => boolean): T | null;
|
|
239
|
-
count<T>(map: Map<string, T>, predicate: (item: T) => boolean): number;
|
|
240
|
-
getEntitiesByBrandapp(brandappId: string): DevEntity[];
|
|
241
|
-
getAttributesByEntity(entityId: string): DevAttribute[];
|
|
242
|
-
getRecordsByEntity(entityId: string): DevRecord[];
|
|
243
|
-
getRecordValues(recordId: string): DevValue[];
|
|
244
|
-
/**
|
|
245
|
-
* Produce a snapshot that is safe to mutate without affecting the store.
|
|
246
|
-
* Dates are preserved by reconstructing them after a structuredClone.
|
|
247
|
-
*/
|
|
248
|
-
toSnapshot(): StoreSnapshot;
|
|
249
|
-
toJSON(): string;
|
|
250
|
-
fromSnapshot(snapshot: StoreSnapshot): void;
|
|
251
|
-
fromJSON(json: string): void;
|
|
252
|
-
clear(): void;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Markdown → EditorSpec converter for dev seed workflows.
|
|
257
|
-
*
|
|
258
|
-
* Production studio writes EditorSpec directly via opt-editor; reopt-www and
|
|
259
|
-
* other marketing sites prefer authoring posts as `.mdx` files committed to
|
|
260
|
-
* git. This helper bridges the two by calling `@reopt-ai/opt-editor`'s
|
|
261
|
-
* `markdownToSpec` so the dev server returns EditorSpec identical to what
|
|
262
|
-
* production studio would produce for the same markdown.
|
|
263
|
-
*
|
|
264
|
-
* `@reopt-ai/opt-editor` is an OPTIONAL peer dependency — the consumer
|
|
265
|
-
* installs it as a devDependency. The dynamic import keeps it out of the
|
|
266
|
-
* production bundle of any consumer that only fetches posts at runtime.
|
|
267
|
-
*
|
|
268
|
-
* Phase 1 scope: plain markdown (headings, paragraphs, lists, code, links,
|
|
269
|
-
* images, blockquote, hr). MDX JSX components (`<Hero />` etc.) are NOT
|
|
270
|
-
* converted — `markdownToSpec` will drop or error on them. Custom element
|
|
271
|
-
* support is Phase 2 (register opt-editor element schemas + mapping table).
|
|
272
|
-
*
|
|
273
|
-
* @example
|
|
274
|
-
* ```ts
|
|
275
|
-
* import { createDevServer } from "@reopt-ai/brandapp-sdk/dev";
|
|
276
|
-
* import { markdownToEditorSpec } from "@reopt-ai/brandapp-sdk/dev";
|
|
277
|
-
* import { readFile } from "node:fs/promises";
|
|
278
|
-
*
|
|
279
|
-
* const mdx = await readFile("content/blog/hello.mdx", "utf-8");
|
|
280
|
-
* const contentRich = await markdownToEditorSpec(mdx);
|
|
281
|
-
*
|
|
282
|
-
* await dev.seedPosts([
|
|
283
|
-
* { groupSlug: "blog", slug: "hello", title: "Hello", contentRich },
|
|
284
|
-
* ]);
|
|
285
|
-
* ```
|
|
286
|
-
*/
|
|
287
|
-
|
|
288
|
-
/**
|
|
289
|
-
* Convert a single markdown string to EditorSpec.
|
|
290
|
-
*
|
|
291
|
-
* Throws if `@reopt-ai/opt-editor` is not installed.
|
|
292
|
-
*/
|
|
293
|
-
declare function markdownToEditorSpec(markdown: string): Promise<EditorSpec>;
|
|
294
|
-
/**
|
|
295
|
-
* Batch helper — converts multiple markdown bodies in one go.
|
|
296
|
-
* Useful when seeding many posts from MDX files.
|
|
297
|
-
*/
|
|
298
|
-
declare function markdownToEditorSpecMany(markdowns: string[]): Promise<EditorSpec[]>;
|
|
299
|
-
|
|
300
|
-
/**
|
|
301
|
-
* @reopt-ai/brandapp-sdk/dev
|
|
302
|
-
*
|
|
303
|
-
* Local development server for BrandApp consumer projects.
|
|
304
|
-
* Provides an in-memory implementation of the full BrandApp API
|
|
305
|
-
* so developers can work offline without hitting the remote server.
|
|
306
|
-
*
|
|
307
|
-
* @example
|
|
308
|
-
* ```ts
|
|
309
|
-
* import { createDevServer } from "@reopt-ai/brandapp-sdk/dev";
|
|
310
|
-
* import schema from "./eav.schema";
|
|
311
|
-
*
|
|
312
|
-
* const dev = await createDevServer({
|
|
313
|
-
* schema,
|
|
314
|
-
* port: 4300,
|
|
315
|
-
* });
|
|
316
|
-
*
|
|
317
|
-
* console.log(`Dev server running at ${dev.url}`);
|
|
318
|
-
*
|
|
319
|
-
* // Seed data
|
|
320
|
-
* await dev.seed({
|
|
321
|
-
* contacts: [
|
|
322
|
-
* { values: { name: "Alice", email: "alice@test.com" } },
|
|
323
|
-
* ],
|
|
324
|
-
* });
|
|
325
|
-
*
|
|
326
|
-
* // Use with SDK
|
|
327
|
-
* const sdk = createReoptSDK({
|
|
328
|
-
* clientId: "dev",
|
|
329
|
-
* clientSecret: "dev",
|
|
330
|
-
* brandappId: "dev",
|
|
331
|
-
* baseUrl: dev.url,
|
|
332
|
-
* });
|
|
333
|
-
* ```
|
|
334
|
-
*/
|
|
335
|
-
|
|
336
|
-
type ProxyConfig = {
|
|
337
|
-
/** Remote Reopt server URL (e.g. "https://brand.reopt.de:3443") */
|
|
338
|
-
remoteUrl: string;
|
|
339
|
-
/** Remote OAuth credentials */
|
|
340
|
-
remoteCredentials: {
|
|
341
|
-
clientId: string;
|
|
342
|
-
clientSecret: string;
|
|
343
|
-
brandappId: string;
|
|
344
|
-
};
|
|
345
|
-
/** Per-module proxy strategy: "local" (in-memory) or "passthrough" (remote) */
|
|
346
|
-
routes?: {
|
|
347
|
-
eav?: "local" | "passthrough";
|
|
348
|
-
ai?: "local" | "passthrough";
|
|
349
|
-
files?: "local" | "passthrough";
|
|
350
|
-
auth?: "local" | "passthrough";
|
|
351
|
-
cms?: "local" | "passthrough";
|
|
352
|
-
terms?: "local" | "passthrough";
|
|
353
|
-
};
|
|
354
|
-
};
|
|
355
|
-
type DevServerOptions = {
|
|
356
|
-
/** Port to listen on (default: 0 = auto-assign) */
|
|
357
|
-
port?: number;
|
|
358
|
-
/** BrandApp ID for dev context (default: "dev-brandapp") */
|
|
359
|
-
brandappId?: string;
|
|
360
|
-
/** Path to persist data across restarts (default: none) */
|
|
361
|
-
dataPath?: string;
|
|
362
|
-
/** Auto-seed entities from EAV schema definition */
|
|
363
|
-
schema?: DevSchema;
|
|
364
|
-
/** Enable verbose logging */
|
|
365
|
-
verbose?: boolean;
|
|
366
|
-
/** Proxy configuration — forward selected API calls to remote server */
|
|
367
|
-
proxy?: ProxyConfig;
|
|
368
|
-
};
|
|
369
|
-
type DevSchema = {
|
|
370
|
-
entities: Record<string, {
|
|
371
|
-
name?: string;
|
|
372
|
-
description?: string;
|
|
373
|
-
icon?: string;
|
|
374
|
-
maxRecords?: number;
|
|
375
|
-
attributes: Record<string, {
|
|
376
|
-
label?: string;
|
|
377
|
-
dataType?: string;
|
|
378
|
-
isRequired?: boolean;
|
|
379
|
-
isUnique?: boolean;
|
|
380
|
-
defaultValue?: string;
|
|
381
|
-
options?: Array<{
|
|
382
|
-
value: string;
|
|
383
|
-
label: string;
|
|
384
|
-
color?: string;
|
|
385
|
-
}>;
|
|
386
|
-
}>;
|
|
387
|
-
}>;
|
|
388
|
-
};
|
|
389
|
-
type SeedRecordInput = {
|
|
390
|
-
authUserId?: string;
|
|
391
|
-
values: Record<string, unknown>;
|
|
392
|
-
/**
|
|
393
|
-
* Per-record upsert key. Defaults to the entity's provided unique
|
|
394
|
-
* attributes, then falls back to all provided value keys in upsert mode.
|
|
395
|
-
*/
|
|
396
|
-
upsertKey?: string | string[];
|
|
397
|
-
};
|
|
398
|
-
type SeedData = Record<string, SeedRecordInput[]>;
|
|
399
|
-
type SeedOptions = {
|
|
400
|
-
/** Append preserves legacy behaviour; upsert refreshes matching records. */
|
|
401
|
-
mode?: "append" | "upsert";
|
|
402
|
-
/** Global upsert key for every record in this seed call. */
|
|
403
|
-
upsertKey?: string | string[];
|
|
404
|
-
};
|
|
405
|
-
type SeedTermsItem = {
|
|
406
|
-
title: string;
|
|
407
|
-
type?: "termsOfService" | "privacyPolicy" | "marketingConsent" | "custom";
|
|
408
|
-
jurisdiction?: TermsJurisdiction;
|
|
409
|
-
isRequired?: boolean;
|
|
410
|
-
/** Defaults to inserting order, ascending. */
|
|
411
|
-
sortOrder?: number;
|
|
412
|
-
/** BCP 47 locale of the current published version. */
|
|
413
|
-
locale?: string;
|
|
414
|
-
/** Markdown / plain-text body of the current published version. */
|
|
415
|
-
content: string;
|
|
416
|
-
changeSummary?: string;
|
|
417
|
-
};
|
|
418
|
-
/**
|
|
419
|
-
* Idempotent PostGroup seed. `(brandappId, slug)` is the upsert key.
|
|
420
|
-
* The server generates `id` on first insert; subsequent calls with the same
|
|
421
|
-
* slug update name/description/color in place.
|
|
422
|
-
*/
|
|
423
|
-
type SeedPostGroupInput = {
|
|
424
|
-
/** 브랜드 내 안정적 식별자. SDK consumer가 이 값으로 그룹을 참조한다. */
|
|
425
|
-
slug: string;
|
|
426
|
-
name: string;
|
|
427
|
-
description?: string;
|
|
428
|
-
color?: string;
|
|
429
|
-
};
|
|
430
|
-
type SeedPostInput = {
|
|
431
|
-
/** 소속 PostGroup의 slug. seedPostGroups로 먼저 만들어두거나 함께 시드 가능. */
|
|
432
|
-
groupSlug: string;
|
|
433
|
-
/** 그룹 내 안정적 식별자 (URL slug). 같은 groupSlug+slug 조합으로 upsert. */
|
|
434
|
-
slug: string;
|
|
435
|
-
title: string;
|
|
436
|
-
/** Plain-text content (검색용). */
|
|
437
|
-
content?: string;
|
|
438
|
-
/** EditorSpec — opt-editor 호환. MDX seed는 dev seeder에서 변환 후 여기에 넣음. */
|
|
439
|
-
contentRich?: EditorSpec | null;
|
|
440
|
-
status?: "draft" | "scheduled" | "published" | "archived";
|
|
441
|
-
publishedAt?: string | Date | null;
|
|
442
|
-
coverImage?: {
|
|
443
|
-
id?: string;
|
|
444
|
-
url: string | null;
|
|
445
|
-
} | null;
|
|
446
|
-
author?: Partial<{
|
|
447
|
-
id: string;
|
|
448
|
-
name: string;
|
|
449
|
-
image: string | null;
|
|
450
|
-
}>;
|
|
451
|
-
icon?: string | null;
|
|
452
|
-
/** Tags 입력 — 문자열은 dev seeder가 `{id: 'tag:<text>', text}` 형태로 정규화. */
|
|
453
|
-
tags?: Array<string | {
|
|
454
|
-
id: string;
|
|
455
|
-
text: string;
|
|
456
|
-
}>;
|
|
457
|
-
seo?: {
|
|
458
|
-
metaTitle?: string | null;
|
|
459
|
-
metaDescription?: string | null;
|
|
460
|
-
metaKeywords?: string | null;
|
|
461
|
-
};
|
|
462
|
-
};
|
|
463
|
-
/**
|
|
464
|
-
* Unified seed input for `dev.seedAll()`. Each field is optional and applied
|
|
465
|
-
* in order: postGroups → posts → entities → terms.
|
|
466
|
-
*/
|
|
467
|
-
type SeedAllInput = {
|
|
468
|
-
postGroups?: SeedPostGroupInput[];
|
|
469
|
-
posts?: SeedPostInput[];
|
|
470
|
-
/** EAV records keyed by entity name — backward-compatible with `dev.seed()`. */
|
|
471
|
-
entities?: SeedData;
|
|
472
|
-
terms?: SeedTermsItem[];
|
|
473
|
-
};
|
|
474
|
-
type DevServer = {
|
|
475
|
-
/** Base URL of the running server */
|
|
476
|
-
url: string;
|
|
477
|
-
/** Port the server is listening on */
|
|
478
|
-
port: number;
|
|
479
|
-
/** The underlying in-memory store */
|
|
480
|
-
store: InMemoryStore;
|
|
481
|
-
/** Seed records into entities by name */
|
|
482
|
-
seed: (data: SeedData, options?: SeedOptions) => Promise<void>;
|
|
483
|
-
/** Seed BrandApp terms with their initial published version */
|
|
484
|
-
seedTerms: (items: SeedTermsItem[]) => Promise<void>;
|
|
485
|
-
/**
|
|
486
|
-
* Seed PostGroups identified by slug. Idempotent — running twice with the
|
|
487
|
-
* same slug updates name/description/color in place.
|
|
488
|
-
*/
|
|
489
|
-
seedPostGroups: (items: SeedPostGroupInput[]) => Promise<void>;
|
|
490
|
-
/**
|
|
491
|
-
* Seed Posts identified by `(groupSlug, slug)`. Idempotent. The PostGroup
|
|
492
|
-
* referenced by `groupSlug` must exist (call `seedPostGroups` first or use
|
|
493
|
-
* `seedAll`).
|
|
494
|
-
*/
|
|
495
|
-
seedPosts: (items: SeedPostInput[]) => Promise<void>;
|
|
496
|
-
/** One-shot seeder that applies postGroups → posts → entities → terms in order. */
|
|
497
|
-
seedAll: (input: SeedAllInput) => Promise<void>;
|
|
498
|
-
/** Reset all data (optionally re-seed schema) */
|
|
499
|
-
reset: () => Promise<void>;
|
|
500
|
-
/** Save current state to a JSON file */
|
|
501
|
-
snapshot: (path: string) => Promise<void>;
|
|
502
|
-
/** Restore state from a JSON file */
|
|
503
|
-
restore: (path: string) => Promise<void>;
|
|
504
|
-
/** Stop the dev server */
|
|
505
|
-
close: () => Promise<void>;
|
|
506
|
-
};
|
|
507
|
-
declare function createDevServer(options?: DevServerOptions): Promise<DevServer>;
|
|
508
|
-
|
|
509
|
-
export { type DevAttribute, type DevEntity, type DevPost, type DevPostGroup, type DevRecord, type DevSchema, type DevServer, type DevServerOptions, InMemoryStore, type ProxyConfig, type SeedAllInput, type SeedData, type SeedOptions, type SeedPostGroupInput, type SeedPostInput, type SeedRecordInput, type SeedTermsItem, type StoreSnapshot, createDevServer, markdownToEditorSpec, markdownToEditorSpecMany };
|
|
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-DrVaKfhs.js";
|
|
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 };
|