@plitzi/sdk-shared 0.30.19 → 0.31.1
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 +22 -3
- package/dist/dataSource/hooks/index.d.ts +3 -3
- package/dist/dataSource/hooks/index.mjs +2 -2
- package/dist/dataSource/hooks/useRegisterSource.d.ts +9 -0
- package/dist/dataSource/hooks/useRegisterSource.mjs +25 -0
- package/dist/dataSource/index.d.ts +0 -1
- package/dist/dataSource/index.mjs +2 -2
- package/dist/devTools/utils/PlitziConsole.d.ts +2 -2
- package/dist/devTools/utils/PlitziConsole.mjs +1 -1
- package/dist/hooks/usePlitziServiceContext.d.ts +1 -2
- package/dist/index.mjs +2 -2
- package/dist/server/rsc/RscProvider.mjs +4 -4
- package/dist/types/AITypes.d.ts +80 -0
- package/dist/types/DataSourceTypes.d.ts +2 -16
- package/dist/types/McpTypes/McpAdapters.d.ts +455 -0
- package/dist/types/McpTypes/McpAdapters.mjs +0 -0
- package/dist/types/McpTypes/index.d.ts +96 -0
- package/dist/types/McpTypes/index.mjs +0 -0
- package/dist/types/SchemaTypes.d.ts +9 -8
- package/dist/types/StateTypes.d.ts +2 -2
- package/dist/types/StoreTypes.d.ts +14 -0
- package/dist/types/index.d.ts +1 -0
- package/eslint.config.mjs +2 -2
- package/package.json +42 -37
- package/dist/dataSource/DataSourceContext.d.ts +0 -3
- package/dist/dataSource/DataSourceContext.mjs +0 -5
- package/dist/dataSource/hooks/useDataSource.d.ts +0 -20
- package/dist/dataSource/hooks/useDataSource.mjs +0 -45
- package/dist/types/McpTypes.d.ts +0 -164
- /package/dist/types/{McpTypes.mjs → AITypes.mjs} +0 -0
|
@@ -0,0 +1,455 @@
|
|
|
1
|
+
import { AiContext, DisplayMode, Resource, StyleCategory, StyleItem, StyleVariableCategory, StyleVariableValue, TagType } from '../..';
|
|
2
|
+
import { McpPlugin, McpSegment, McpStyleVariable } from '../McpTypes';
|
|
3
|
+
import { DropPosition, Element, PageFolder, Schema, SchemaVariable } from '../SchemaTypes';
|
|
4
|
+
import { Theme } from '../ThemeTypes';
|
|
5
|
+
export type McpAdapter<R = any, T extends Record<string, any> = Record<string, any>> = (args: T, ctx: AiContext) => Promise<{
|
|
6
|
+
data: R;
|
|
7
|
+
} | {
|
|
8
|
+
error: Error | string;
|
|
9
|
+
}>;
|
|
10
|
+
export type McpAdaptersSchema = {
|
|
11
|
+
applyPreview: McpAdapter<{
|
|
12
|
+
baseElementId: string;
|
|
13
|
+
targetParentId: string;
|
|
14
|
+
elementCount: number;
|
|
15
|
+
}, {
|
|
16
|
+
schema: {
|
|
17
|
+
flat: Record<string, Element>;
|
|
18
|
+
};
|
|
19
|
+
style?: Record<string, unknown>;
|
|
20
|
+
baseElementId: string;
|
|
21
|
+
targetParentId: string;
|
|
22
|
+
dropPosition?: DropPosition;
|
|
23
|
+
}>;
|
|
24
|
+
};
|
|
25
|
+
export type PageElementSummary = {
|
|
26
|
+
id: string;
|
|
27
|
+
label: string;
|
|
28
|
+
type: string;
|
|
29
|
+
parentId: string | null;
|
|
30
|
+
attributes: Record<string, unknown>;
|
|
31
|
+
};
|
|
32
|
+
export type McpAdaptersPages = {
|
|
33
|
+
getPage: McpAdapter<{
|
|
34
|
+
page: Element;
|
|
35
|
+
elements: PageElementSummary[];
|
|
36
|
+
} | undefined, {
|
|
37
|
+
pageId: string;
|
|
38
|
+
}>;
|
|
39
|
+
getPages: McpAdapter<Element[]>;
|
|
40
|
+
getPageBySlug: McpAdapter<Element | undefined, {
|
|
41
|
+
slug: string;
|
|
42
|
+
}>;
|
|
43
|
+
createPage: McpAdapter<Element, {
|
|
44
|
+
name: string;
|
|
45
|
+
}>;
|
|
46
|
+
updatePage: McpAdapter<Element, {
|
|
47
|
+
pageId: string;
|
|
48
|
+
updates: {
|
|
49
|
+
name?: string;
|
|
50
|
+
slug?: string;
|
|
51
|
+
default?: boolean;
|
|
52
|
+
folder?: string;
|
|
53
|
+
};
|
|
54
|
+
}>;
|
|
55
|
+
deletePage: McpAdapter<boolean, {
|
|
56
|
+
pageId: string;
|
|
57
|
+
}>;
|
|
58
|
+
};
|
|
59
|
+
export type McpAdaptersPageFolders = {
|
|
60
|
+
getPageFolder: McpAdapter<PageFolder | undefined, {
|
|
61
|
+
folderId: string;
|
|
62
|
+
}>;
|
|
63
|
+
getPageFolders: McpAdapter<PageFolder[]>;
|
|
64
|
+
createPageFolder: McpAdapter<PageFolder, {
|
|
65
|
+
name: string;
|
|
66
|
+
parentId?: string;
|
|
67
|
+
}>;
|
|
68
|
+
updatePageFolder: McpAdapter<PageFolder, {
|
|
69
|
+
id: string;
|
|
70
|
+
updates: Partial<Pick<PageFolder, 'name' | 'slug' | 'parentId'>>;
|
|
71
|
+
}>;
|
|
72
|
+
deletePageFolder: McpAdapter<boolean, {
|
|
73
|
+
id: string;
|
|
74
|
+
}>;
|
|
75
|
+
};
|
|
76
|
+
export type McpAdaptersElements = {
|
|
77
|
+
createElement: McpAdapter<Element | undefined, {
|
|
78
|
+
element: Element;
|
|
79
|
+
parentId?: string;
|
|
80
|
+
position?: number;
|
|
81
|
+
}>;
|
|
82
|
+
getElement: McpAdapter<Element | undefined, {
|
|
83
|
+
elementId: string;
|
|
84
|
+
}>;
|
|
85
|
+
getElements: McpAdapter<Element[], {
|
|
86
|
+
pageId?: string;
|
|
87
|
+
type?: string;
|
|
88
|
+
parentId?: string;
|
|
89
|
+
}>;
|
|
90
|
+
listElements: McpAdapter<{
|
|
91
|
+
id: string;
|
|
92
|
+
label: string;
|
|
93
|
+
type: string;
|
|
94
|
+
parentId?: string;
|
|
95
|
+
items?: string[];
|
|
96
|
+
}[], {
|
|
97
|
+
rootId?: string;
|
|
98
|
+
parentId?: string;
|
|
99
|
+
type?: string;
|
|
100
|
+
}>;
|
|
101
|
+
updateElement: McpAdapter<Element, Element>;
|
|
102
|
+
deleteElement: McpAdapter<boolean, {
|
|
103
|
+
elementId: string;
|
|
104
|
+
}>;
|
|
105
|
+
moveElement: McpAdapter<boolean, {
|
|
106
|
+
elementId: string;
|
|
107
|
+
toParentId: string;
|
|
108
|
+
dropPosition?: DropPosition;
|
|
109
|
+
}>;
|
|
110
|
+
cloneElement: McpAdapter<{
|
|
111
|
+
id: string;
|
|
112
|
+
label: string;
|
|
113
|
+
type: string;
|
|
114
|
+
parentId?: string;
|
|
115
|
+
items?: string[];
|
|
116
|
+
}[], {
|
|
117
|
+
elementId: string;
|
|
118
|
+
to: string;
|
|
119
|
+
dropPosition: DropPosition;
|
|
120
|
+
}>;
|
|
121
|
+
};
|
|
122
|
+
export type McpAdaptersSchemaVariables = {
|
|
123
|
+
getVariable: McpAdapter<SchemaVariable | undefined, {
|
|
124
|
+
name: string;
|
|
125
|
+
}>;
|
|
126
|
+
getVariables: McpAdapter<SchemaVariable[]>;
|
|
127
|
+
createSchemaVariable: McpAdapter<SchemaVariable, {
|
|
128
|
+
variable: Pick<SchemaVariable, 'name' | 'type' | 'value' | 'category'>;
|
|
129
|
+
}>;
|
|
130
|
+
updateSchemaVariable: McpAdapter<SchemaVariable, {
|
|
131
|
+
variable: Partial<SchemaVariable> & {
|
|
132
|
+
name: string;
|
|
133
|
+
};
|
|
134
|
+
}>;
|
|
135
|
+
deleteSchemaVariable: McpAdapter<boolean, {
|
|
136
|
+
name: string;
|
|
137
|
+
}>;
|
|
138
|
+
};
|
|
139
|
+
export type McpAdaptersStyles = {
|
|
140
|
+
getStyleVariables: McpAdapter<Record<string, Record<string, StyleVariableValue>>>;
|
|
141
|
+
getStyleVariable: McpAdapter<StyleVariableValue | undefined, {
|
|
142
|
+
category: StyleVariableCategory;
|
|
143
|
+
name: string;
|
|
144
|
+
}>;
|
|
145
|
+
getStyleSelectors: McpAdapter<Record<string, string[]>, {
|
|
146
|
+
displayMode?: string;
|
|
147
|
+
}>;
|
|
148
|
+
updateStyle: McpAdapter;
|
|
149
|
+
updateStyleSettings: McpAdapter;
|
|
150
|
+
};
|
|
151
|
+
export type McpAdaptersStylesVariables = {
|
|
152
|
+
createStyleVariable: McpAdapter<{
|
|
153
|
+
category: StyleVariableCategory;
|
|
154
|
+
name: string;
|
|
155
|
+
value: StyleVariableValue;
|
|
156
|
+
}, McpStyleVariable>;
|
|
157
|
+
updateStyleVariable: McpAdapter<McpStyleVariable, {
|
|
158
|
+
category: StyleVariableCategory;
|
|
159
|
+
name: string;
|
|
160
|
+
value: StyleVariableValue;
|
|
161
|
+
}>;
|
|
162
|
+
deleteStyleVariable: McpAdapter<boolean, {
|
|
163
|
+
category: StyleVariableCategory;
|
|
164
|
+
name: string;
|
|
165
|
+
}>;
|
|
166
|
+
};
|
|
167
|
+
export type McpAdaptersStylesSelectors = {
|
|
168
|
+
createStyleSelector: McpAdapter<StyleItem, {
|
|
169
|
+
displayMode: DisplayMode;
|
|
170
|
+
selector: string;
|
|
171
|
+
type: TagType;
|
|
172
|
+
path?: StyleCategory;
|
|
173
|
+
style?: StyleItem['attributes'];
|
|
174
|
+
params?: Record<string, unknown>;
|
|
175
|
+
}>;
|
|
176
|
+
updateStyleSelector: McpAdapter<StyleItem, {
|
|
177
|
+
displayMode: DisplayMode;
|
|
178
|
+
selector: string;
|
|
179
|
+
type: TagType;
|
|
180
|
+
path?: StyleCategory;
|
|
181
|
+
style?: StyleItem['attributes'];
|
|
182
|
+
params?: Record<string, unknown>;
|
|
183
|
+
}>;
|
|
184
|
+
deleteStyleSelector: McpAdapter<boolean, {
|
|
185
|
+
displayMode: DisplayMode;
|
|
186
|
+
selector: string;
|
|
187
|
+
}>;
|
|
188
|
+
};
|
|
189
|
+
export type McpAdaptersSegments = {
|
|
190
|
+
createSegment: McpAdapter<McpSegment, {
|
|
191
|
+
name: string;
|
|
192
|
+
description: string;
|
|
193
|
+
}>;
|
|
194
|
+
updateSegment: McpAdapter<McpSegment, {
|
|
195
|
+
segmentId: string;
|
|
196
|
+
updates: {
|
|
197
|
+
name?: string;
|
|
198
|
+
description?: string;
|
|
199
|
+
};
|
|
200
|
+
}>;
|
|
201
|
+
deleteSegment: McpAdapter<boolean, {
|
|
202
|
+
segmentId: string;
|
|
203
|
+
}>;
|
|
204
|
+
getSegment: McpAdapter<Record<string, unknown> | undefined, {
|
|
205
|
+
segmentId?: string;
|
|
206
|
+
identifier?: string;
|
|
207
|
+
}>;
|
|
208
|
+
getSegments: McpAdapter<Record<string, unknown>[], {
|
|
209
|
+
cursor?: string;
|
|
210
|
+
limit?: number;
|
|
211
|
+
}>;
|
|
212
|
+
createSegmentElement: McpAdapter<Element, {
|
|
213
|
+
segmentId: string;
|
|
214
|
+
element: {
|
|
215
|
+
type: string;
|
|
216
|
+
label: string;
|
|
217
|
+
props?: Record<string, unknown>;
|
|
218
|
+
};
|
|
219
|
+
parentId: string;
|
|
220
|
+
}>;
|
|
221
|
+
updateSegmentElement: McpAdapter<Element, {
|
|
222
|
+
segmentId: string;
|
|
223
|
+
elementId: string;
|
|
224
|
+
updates: {
|
|
225
|
+
label?: string;
|
|
226
|
+
props?: Record<string, unknown>;
|
|
227
|
+
};
|
|
228
|
+
}>;
|
|
229
|
+
moveSegmentElement: McpAdapter<boolean, {
|
|
230
|
+
segmentId: string;
|
|
231
|
+
elementId: string;
|
|
232
|
+
toParentId: string;
|
|
233
|
+
dropPosition?: DropPosition;
|
|
234
|
+
}>;
|
|
235
|
+
deleteSegmentElement: McpAdapter<boolean, {
|
|
236
|
+
segmentId: string;
|
|
237
|
+
elementId: string;
|
|
238
|
+
}>;
|
|
239
|
+
cloneSegmentElement: McpAdapter;
|
|
240
|
+
createSegmentVariable: McpAdapter<SchemaVariable, {
|
|
241
|
+
segmentId: string;
|
|
242
|
+
variable: Pick<SchemaVariable, 'name' | 'type' | 'value' | 'category'>;
|
|
243
|
+
}>;
|
|
244
|
+
updateSegmentVariable: McpAdapter<SchemaVariable, {
|
|
245
|
+
segmentId: string;
|
|
246
|
+
variable: Partial<SchemaVariable> & {
|
|
247
|
+
name: string;
|
|
248
|
+
};
|
|
249
|
+
}>;
|
|
250
|
+
deleteSegmentVariable: McpAdapter<boolean, {
|
|
251
|
+
segmentId: string;
|
|
252
|
+
name: string;
|
|
253
|
+
}>;
|
|
254
|
+
createSegmentStyleVariable: McpAdapter<McpStyleVariable, {
|
|
255
|
+
segmentId: string;
|
|
256
|
+
category: StyleVariableCategory;
|
|
257
|
+
name: string;
|
|
258
|
+
value: StyleVariableValue;
|
|
259
|
+
}>;
|
|
260
|
+
updateSegmentStyleVariable: McpAdapter<McpStyleVariable, {
|
|
261
|
+
segmentId: string;
|
|
262
|
+
category: StyleVariableCategory;
|
|
263
|
+
name: string;
|
|
264
|
+
value: StyleVariableValue;
|
|
265
|
+
}>;
|
|
266
|
+
deleteSegmentStyleVariable: McpAdapter<boolean, {
|
|
267
|
+
segmentId: string;
|
|
268
|
+
category: StyleVariableCategory;
|
|
269
|
+
name: string;
|
|
270
|
+
}>;
|
|
271
|
+
addSegmentStyleSelector: McpAdapter<StyleItem, {
|
|
272
|
+
segmentId: string;
|
|
273
|
+
displayMode: DisplayMode;
|
|
274
|
+
selector: string;
|
|
275
|
+
type: TagType;
|
|
276
|
+
path?: StyleCategory;
|
|
277
|
+
style?: StyleItem['attributes'];
|
|
278
|
+
params: Record<string, unknown>;
|
|
279
|
+
}>;
|
|
280
|
+
updateSegmentStyleSelector: McpAdapter<StyleItem, {
|
|
281
|
+
segmentId: string;
|
|
282
|
+
displayMode: DisplayMode;
|
|
283
|
+
selector: string;
|
|
284
|
+
path?: StyleCategory;
|
|
285
|
+
style?: StyleItem['attributes'];
|
|
286
|
+
params: Record<string, unknown>;
|
|
287
|
+
}>;
|
|
288
|
+
deleteSegmentStyleSelector: McpAdapter<boolean, {
|
|
289
|
+
segmentId: string;
|
|
290
|
+
displayMode: DisplayMode;
|
|
291
|
+
selector: string;
|
|
292
|
+
}>;
|
|
293
|
+
addSegmentStyleSelectorVariable: McpAdapter<{
|
|
294
|
+
displayMode: DisplayMode;
|
|
295
|
+
selector: string;
|
|
296
|
+
category: StyleVariableCategory;
|
|
297
|
+
name: string;
|
|
298
|
+
value: StyleVariableValue;
|
|
299
|
+
}, {
|
|
300
|
+
segmentId: string;
|
|
301
|
+
displayMode: DisplayMode;
|
|
302
|
+
selector: string;
|
|
303
|
+
category: StyleVariableCategory;
|
|
304
|
+
name: string;
|
|
305
|
+
value: StyleVariableValue;
|
|
306
|
+
}>;
|
|
307
|
+
updateSegmentStyleSelectorVariable: McpAdapter<{
|
|
308
|
+
displayMode: DisplayMode;
|
|
309
|
+
selector: string;
|
|
310
|
+
category: StyleVariableCategory;
|
|
311
|
+
name: string;
|
|
312
|
+
value: StyleVariableValue;
|
|
313
|
+
}, {
|
|
314
|
+
segmentId: string;
|
|
315
|
+
displayMode: DisplayMode;
|
|
316
|
+
selector: string;
|
|
317
|
+
category: StyleVariableCategory;
|
|
318
|
+
name: string;
|
|
319
|
+
value: StyleVariableValue;
|
|
320
|
+
}>;
|
|
321
|
+
removeSegmentStyleSelectorVariable: McpAdapter<boolean, {
|
|
322
|
+
segmentId: string;
|
|
323
|
+
displayMode: DisplayMode;
|
|
324
|
+
selector: string;
|
|
325
|
+
category: StyleVariableCategory;
|
|
326
|
+
name: string;
|
|
327
|
+
}>;
|
|
328
|
+
addSegmentSelectorVariable: McpAdapter<{
|
|
329
|
+
displayMode: DisplayMode;
|
|
330
|
+
selector: string;
|
|
331
|
+
category: StyleVariableCategory;
|
|
332
|
+
name: string;
|
|
333
|
+
value: StyleVariableValue;
|
|
334
|
+
}, {
|
|
335
|
+
segmentId: string;
|
|
336
|
+
displayMode: DisplayMode;
|
|
337
|
+
selector: string;
|
|
338
|
+
category: StyleVariableCategory;
|
|
339
|
+
name: string;
|
|
340
|
+
value: StyleVariableValue;
|
|
341
|
+
}>;
|
|
342
|
+
updateSegmentSelectorVariable: McpAdapter<{
|
|
343
|
+
displayMode: DisplayMode;
|
|
344
|
+
selector: string;
|
|
345
|
+
category: StyleVariableCategory;
|
|
346
|
+
name: string;
|
|
347
|
+
value: StyleVariableValue;
|
|
348
|
+
}, {
|
|
349
|
+
segmentId: string;
|
|
350
|
+
displayMode: DisplayMode;
|
|
351
|
+
selector: string;
|
|
352
|
+
category: StyleVariableCategory;
|
|
353
|
+
name: string;
|
|
354
|
+
value: StyleVariableValue;
|
|
355
|
+
}>;
|
|
356
|
+
removeSegmentSelectorVariable: McpAdapter<boolean, {
|
|
357
|
+
segmentId: string;
|
|
358
|
+
displayMode: DisplayMode;
|
|
359
|
+
selector: string;
|
|
360
|
+
category: StyleVariableCategory;
|
|
361
|
+
name: string;
|
|
362
|
+
}>;
|
|
363
|
+
};
|
|
364
|
+
export type McpAdaptersPlugins = {
|
|
365
|
+
listPlugins: McpAdapter<McpPlugin[]>;
|
|
366
|
+
addPlugin: McpAdapter<{
|
|
367
|
+
type: string;
|
|
368
|
+
resource: string;
|
|
369
|
+
settings: Record<string, unknown>;
|
|
370
|
+
}, {
|
|
371
|
+
pluginType: string;
|
|
372
|
+
resource: string;
|
|
373
|
+
override?: boolean;
|
|
374
|
+
}>;
|
|
375
|
+
updatePlugin: McpAdapter<{
|
|
376
|
+
type: string;
|
|
377
|
+
resource: string;
|
|
378
|
+
settings: Record<string, unknown>;
|
|
379
|
+
}, {
|
|
380
|
+
pluginType: string;
|
|
381
|
+
resource: string;
|
|
382
|
+
}>;
|
|
383
|
+
removePlugin: McpAdapter<boolean, {
|
|
384
|
+
pluginType: string;
|
|
385
|
+
}>;
|
|
386
|
+
};
|
|
387
|
+
export type McpAdaptersCollections = {
|
|
388
|
+
getCollections: McpAdapter<Record<string, unknown>[], Record<string, unknown>>;
|
|
389
|
+
getCollection: McpAdapter<Record<string, unknown> | undefined, {
|
|
390
|
+
collectionId: string;
|
|
391
|
+
}>;
|
|
392
|
+
createCollection: McpAdapter;
|
|
393
|
+
updateCollection: McpAdapter;
|
|
394
|
+
deleteCollection: McpAdapter<boolean, any>;
|
|
395
|
+
getCollectionRecords: McpAdapter;
|
|
396
|
+
getCollectionRecord: McpAdapter;
|
|
397
|
+
createCollectionRecord: McpAdapter;
|
|
398
|
+
updateCollectionRecord: McpAdapter;
|
|
399
|
+
deleteCollectionRecord: McpAdapter<boolean, {
|
|
400
|
+
collectionId: string;
|
|
401
|
+
recordId: string;
|
|
402
|
+
}>;
|
|
403
|
+
};
|
|
404
|
+
export type McpAdaptersResources = {
|
|
405
|
+
getResources: McpAdapter;
|
|
406
|
+
getResource: McpAdapter<Resource | undefined, {
|
|
407
|
+
identifier: string;
|
|
408
|
+
cdnIdentifier: string;
|
|
409
|
+
}>;
|
|
410
|
+
addResource: McpAdapter<Resource | undefined, {
|
|
411
|
+
url: string;
|
|
412
|
+
cdnIdentifier: string;
|
|
413
|
+
filename?: string;
|
|
414
|
+
type?: string;
|
|
415
|
+
prefix?: string;
|
|
416
|
+
compression?: string;
|
|
417
|
+
}>;
|
|
418
|
+
moveResource: McpAdapter<Resource | undefined, {
|
|
419
|
+
identifier: string;
|
|
420
|
+
cdnIdentifier: string;
|
|
421
|
+
prefix: string;
|
|
422
|
+
}>;
|
|
423
|
+
removeResource: McpAdapter<{
|
|
424
|
+
id: string;
|
|
425
|
+
} | undefined, {
|
|
426
|
+
identifier: string;
|
|
427
|
+
cdnIdentifier: string;
|
|
428
|
+
}>;
|
|
429
|
+
};
|
|
430
|
+
export type McpAdaptersSpace = {
|
|
431
|
+
getSpaceSettings: McpAdapter<Schema['settings'] | undefined>;
|
|
432
|
+
updateSpaceSettings: McpAdapter<Schema['settings'], {
|
|
433
|
+
path?: string;
|
|
434
|
+
value?: string | number | boolean;
|
|
435
|
+
}>;
|
|
436
|
+
};
|
|
437
|
+
export type McpAdapters = {
|
|
438
|
+
getBuilderContext: McpAdapter<{
|
|
439
|
+
currentPageId?: string;
|
|
440
|
+
selectedElementId?: string;
|
|
441
|
+
cssVariables: Record<string, {
|
|
442
|
+
default: string;
|
|
443
|
+
light?: string;
|
|
444
|
+
dark?: string;
|
|
445
|
+
}> | undefined;
|
|
446
|
+
elementDefaults: any;
|
|
447
|
+
elements: {
|
|
448
|
+
id: string;
|
|
449
|
+
label: string;
|
|
450
|
+
type: string;
|
|
451
|
+
parentId?: string;
|
|
452
|
+
}[];
|
|
453
|
+
theme?: Exclude<Theme, 'system'>;
|
|
454
|
+
} | undefined>;
|
|
455
|
+
} & McpAdaptersSchema & McpAdaptersPages & McpAdaptersPageFolders & McpAdaptersElements & McpAdaptersSchemaVariables & McpAdaptersStyles & McpAdaptersStylesVariables & McpAdaptersStylesSelectors & McpAdaptersSegments & McpAdaptersPlugins & McpAdaptersCollections & McpAdaptersResources & McpAdaptersSpace;
|
|
File without changes
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { AiContext, AiMode, PromptRole } from '../AITypes';
|
|
2
|
+
import { StyleVariableCategory, StyleVariableValue } from '../StyleTypes';
|
|
3
|
+
import { McpAdapters } from './McpAdapters';
|
|
4
|
+
import { ToolAnnotations } from '@modelcontextprotocol/sdk/types';
|
|
5
|
+
import { ZodType } from 'zod';
|
|
6
|
+
export * from './McpAdapters';
|
|
7
|
+
export type McpPlugin = {
|
|
8
|
+
name: string;
|
|
9
|
+
version?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
};
|
|
12
|
+
export type McpStyleVariable = {
|
|
13
|
+
category: StyleVariableCategory;
|
|
14
|
+
name: string;
|
|
15
|
+
value: StyleVariableValue;
|
|
16
|
+
};
|
|
17
|
+
export type McpSegment = {
|
|
18
|
+
id?: string;
|
|
19
|
+
identifier: string;
|
|
20
|
+
definition: {
|
|
21
|
+
name: string;
|
|
22
|
+
description: string;
|
|
23
|
+
baseElementId: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export type ToolOperationType = 'read' | 'write';
|
|
27
|
+
export type McpPromptHandlerResult = {
|
|
28
|
+
messages: {
|
|
29
|
+
role: Exclude<PromptRole, 'system'>;
|
|
30
|
+
content: {
|
|
31
|
+
type: 'text';
|
|
32
|
+
text: string;
|
|
33
|
+
};
|
|
34
|
+
}[];
|
|
35
|
+
};
|
|
36
|
+
export type McpPromptHandler = (args: Record<string, any>, ctx: AiContext) => Promise<McpPromptHandlerResult>;
|
|
37
|
+
export type McpPrompt = {
|
|
38
|
+
name: string;
|
|
39
|
+
definition: {
|
|
40
|
+
title: string;
|
|
41
|
+
description: string;
|
|
42
|
+
argsSchema?: Record<string, any>;
|
|
43
|
+
};
|
|
44
|
+
handler: McpPromptHandler;
|
|
45
|
+
};
|
|
46
|
+
export type McpResource = {
|
|
47
|
+
uri: string;
|
|
48
|
+
name: string;
|
|
49
|
+
description: string;
|
|
50
|
+
mimeType: string;
|
|
51
|
+
content: string;
|
|
52
|
+
};
|
|
53
|
+
export type McpToolHandlerResult = {
|
|
54
|
+
content: {
|
|
55
|
+
type: 'text';
|
|
56
|
+
text: string;
|
|
57
|
+
}[];
|
|
58
|
+
data?: unknown;
|
|
59
|
+
structuredContent?: Record<string, unknown>;
|
|
60
|
+
isError?: true;
|
|
61
|
+
};
|
|
62
|
+
export type ToolCallEvent = {
|
|
63
|
+
name: string;
|
|
64
|
+
args: Record<string, unknown>;
|
|
65
|
+
result: unknown;
|
|
66
|
+
};
|
|
67
|
+
export type McpToolLifecycleHooks = {
|
|
68
|
+
can?: (name: string, args: Record<string, unknown>, ctx?: AiContext) => boolean | Promise<boolean>;
|
|
69
|
+
before?: (name: string, args: Record<string, unknown>, ctx?: AiContext) => boolean | undefined | Promise<boolean> | Promise<undefined>;
|
|
70
|
+
after?: (name: string, args: Record<string, unknown>, result: McpToolHandlerResult, ctx?: AiContext) => void | Promise<void>;
|
|
71
|
+
onError?: (name: string, args: Record<string, unknown>, error: Error, ctx?: AiContext) => void | Promise<void>;
|
|
72
|
+
};
|
|
73
|
+
export type McpToolHandler<T extends Record<string, unknown> = any> = (args: T, ctx: AiContext) => Promise<McpToolHandlerResult> | McpToolHandlerResult;
|
|
74
|
+
export type McpTool = {
|
|
75
|
+
name: string;
|
|
76
|
+
mcpDefinition: {
|
|
77
|
+
title?: string;
|
|
78
|
+
description: string;
|
|
79
|
+
inputSchema?: ZodType<any, any, any>;
|
|
80
|
+
outputSchema?: ZodType<any, any, any>;
|
|
81
|
+
annotations?: ToolAnnotations;
|
|
82
|
+
};
|
|
83
|
+
definition: {
|
|
84
|
+
allowedModes: AiMode[];
|
|
85
|
+
};
|
|
86
|
+
adapterName?: keyof McpAdapters;
|
|
87
|
+
handler?: McpToolHandler;
|
|
88
|
+
};
|
|
89
|
+
export type McpServerConfig = {
|
|
90
|
+
enabled?: boolean;
|
|
91
|
+
path?: string;
|
|
92
|
+
adapters: Partial<McpAdapters>;
|
|
93
|
+
tools?: McpTool[];
|
|
94
|
+
prompts?: McpPrompt[];
|
|
95
|
+
resources?: McpResource[];
|
|
96
|
+
};
|
|
File without changes
|
|
@@ -51,7 +51,8 @@ export type ElementDefinition = {
|
|
|
51
51
|
items?: Element['id'][];
|
|
52
52
|
styleSelectors: {
|
|
53
53
|
base: string;
|
|
54
|
-
|
|
54
|
+
[selector: string]: string;
|
|
55
|
+
};
|
|
55
56
|
bindings?: Partial<Record<BindingCategory, ElementBinding[]>>;
|
|
56
57
|
interactions?: Record<string, ElementInteraction>;
|
|
57
58
|
initialState?: {
|
|
@@ -65,25 +66,24 @@ export type ElementDefinition = {
|
|
|
65
66
|
/** Controls when the element is loaded/rendered. */
|
|
66
67
|
loadStrategy?: ElementLoadStrategy;
|
|
67
68
|
};
|
|
68
|
-
export type Element<TAttributes extends Record<string, unknown> =
|
|
69
|
-
[key: string]: unknown;
|
|
70
|
-
}, 'subType'>> = {
|
|
69
|
+
export type Element<TAttributes extends Record<string, unknown> = Record<string, unknown>> = {
|
|
71
70
|
id: string;
|
|
72
71
|
attributes: TAttributes & {
|
|
73
72
|
subType?: string;
|
|
74
73
|
};
|
|
75
74
|
definition: ElementDefinition;
|
|
76
75
|
};
|
|
77
|
-
|
|
76
|
+
type SchemaVariableBase<TType extends string, TValue> = {
|
|
78
77
|
name: string;
|
|
79
78
|
category: string;
|
|
80
|
-
type:
|
|
81
|
-
value:
|
|
79
|
+
type: TType;
|
|
80
|
+
value: TValue;
|
|
82
81
|
subValues: {
|
|
83
82
|
when: RuleGroup;
|
|
84
|
-
value:
|
|
83
|
+
value: TValue;
|
|
85
84
|
}[];
|
|
86
85
|
};
|
|
86
|
+
export type SchemaVariable = SchemaVariableBase<'number', number> | SchemaVariableBase<'checkbox' | 'switch', boolean> | SchemaVariableBase<'text' | 'email' | 'password' | 'select' | 'select2' | 'textarea' | 'color', string>;
|
|
87
87
|
export type PageFolder = {
|
|
88
88
|
id: string;
|
|
89
89
|
name: string;
|
|
@@ -150,3 +150,4 @@ export type SchemaRaw = {
|
|
|
150
150
|
pages: Element['id'][];
|
|
151
151
|
pageFolders: PageFolder[];
|
|
152
152
|
};
|
|
153
|
+
export {};
|
|
@@ -2,6 +2,6 @@ import { Dispatch, SetStateAction } from 'react';
|
|
|
2
2
|
export type StateManagerContextValue = {
|
|
3
3
|
state: Record<string, unknown>;
|
|
4
4
|
setState: Dispatch<SetStateAction<Record<string, unknown>>>;
|
|
5
|
-
setStateByKey: (key: string, value: unknown, storeMode?:
|
|
6
|
-
clearCache: (storeMode?:
|
|
5
|
+
setStateByKey: (key: string, value: unknown, storeMode?: 'localStorage' | 'sessionStorage') => void;
|
|
6
|
+
clearCache: (storeMode?: 'localStorage' | 'sessionStorage') => void;
|
|
7
7
|
};
|
|
@@ -1,12 +1,26 @@
|
|
|
1
|
+
import { Source } from './DataSourceTypes';
|
|
1
2
|
import { Schema, Element } from './SchemaTypes';
|
|
2
3
|
import { Segment } from './SegmentTypes';
|
|
3
4
|
import { DisplayMode, Style, StyleState } from './StyleTypes';
|
|
5
|
+
export type RuntimeSourceValues = {
|
|
6
|
+
variables?: Record<string, unknown>;
|
|
7
|
+
navigation?: {
|
|
8
|
+
routeParams: Record<string, unknown>;
|
|
9
|
+
queryParams: Record<string, unknown>;
|
|
10
|
+
};
|
|
11
|
+
auth?: Record<string, unknown>;
|
|
12
|
+
page?: Record<string, unknown>;
|
|
13
|
+
};
|
|
4
14
|
export type CommonState = {
|
|
5
15
|
prevSchema?: Schema;
|
|
6
16
|
schema: Schema;
|
|
7
17
|
pageDefinitions: Record<string, Element>;
|
|
8
18
|
style: Style;
|
|
9
19
|
segments: Record<string, Segment>;
|
|
20
|
+
runtime?: {
|
|
21
|
+
sources?: RuntimeSourceValues & Record<string, unknown>;
|
|
22
|
+
};
|
|
23
|
+
sources?: Record<string, Source>;
|
|
10
24
|
};
|
|
11
25
|
export type BuilderState = CommonState & {
|
|
12
26
|
displayMode: DisplayMode;
|
package/dist/types/index.d.ts
CHANGED
package/eslint.config.mjs
CHANGED
|
@@ -69,8 +69,8 @@ export default tsEslint.config({
|
|
|
69
69
|
{
|
|
70
70
|
groups: ['builtin', 'external', 'internal', ['parent', 'sibling', 'index'], 'type'],
|
|
71
71
|
pathGroups: [
|
|
72
|
-
{ pattern: '@plitzi
|
|
73
|
-
{ pattern: '@plitzi
|
|
72
|
+
{ pattern: '@plitzi/+(sdk-*|nexus)/**', group: 'internal' },
|
|
73
|
+
{ pattern: '@plitzi/+(sdk-*|nexus)', group: 'internal' }
|
|
74
74
|
// { pattern: '@icons/**', group: 'internal' },
|
|
75
75
|
// { pattern: '@components/**', group: 'internal' },
|
|
76
76
|
// { pattern: '@hooks/**', group: 'internal' },
|