@synap-core/types 1.2.19 → 1.2.22
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/.turbo/turbo-build.log +16 -49
- package/dist/chunk-2N5ZC5EB.js +0 -0
- package/dist/chunk-46DY5LY3.js +76 -0
- package/dist/chunk-BBMRDSWW.js +0 -0
- package/dist/chunk-DYNDZON6.js +203 -0
- package/dist/chunk-E4TRCFI3.js +144 -0
- package/dist/chunk-GX24H4PF.js +0 -0
- package/dist/chunk-IZA3UKBT.js +0 -0
- package/dist/chunk-QAWJ6GM3.js +0 -0
- package/dist/chunk-SAGFDFV4.js +0 -0
- package/dist/chunk-WK2VJ2JT.js +1440 -0
- package/dist/chunk-X5L3VJJZ.js +0 -0
- package/dist/documents/index.d.ts +1351 -0
- package/dist/documents/index.js +13 -0
- package/dist/entities/index.d.ts +38 -0
- package/dist/entities/index.js +24 -0
- package/dist/events/index.d.ts +139 -0
- package/dist/events/index.js +15 -0
- package/dist/inbox/index.d.ts +2 -0
- package/dist/inbox/index.js +1 -0
- package/dist/index.d.ts +423 -6110
- package/dist/index.js +136 -1909
- package/dist/preferences/index.d.ts +925 -0
- package/dist/preferences/index.js +18 -0
- package/dist/proposals/index.d.ts +629 -0
- package/dist/proposals/index.js +9 -0
- package/dist/realtime/index.d.ts +77 -0
- package/dist/realtime/index.js +1 -0
- package/dist/relations/index.d.ts +209 -0
- package/dist/relations/index.js +1 -0
- package/dist/types-DEHO6DAD.d.ts +662 -0
- package/dist/users/index.d.ts +724 -0
- package/dist/users/index.js +1 -0
- package/dist/views/index.d.ts +594 -0
- package/dist/views/index.js +28 -0
- package/dist/workspaces/index.d.ts +526 -0
- package/dist/workspaces/index.js +1 -0
- package/package.json +2 -2
- package/tsup.config.ts +14 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,49 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
ESM dist/relations/index.js 31.00 B
|
|
18
|
-
ESM dist/chunk-X5L3VJJZ.js 0 B
|
|
19
|
-
ESM dist/views/index.js 642.00 B
|
|
20
|
-
ESM dist/workspaces/index.js 31.00 B
|
|
21
|
-
ESM dist/index.js 19.07 KB
|
|
22
|
-
ESM dist/chunk-E4TRCFI3.js 3.94 KB
|
|
23
|
-
ESM dist/documents/index.js 298.00 B
|
|
24
|
-
ESM dist/chunk-ES7GZ7IQ.js 327.00 B
|
|
25
|
-
ESM dist/chunk-HFVZISQ7.js 4.14 KB
|
|
26
|
-
ESM dist/events/index.js 405.00 B
|
|
27
|
-
ESM dist/entities/index.js 372.00 B
|
|
28
|
-
ESM dist/inbox/index.js 31.00 B
|
|
29
|
-
ESM dist/chunk-MUAPS3OD.js 2.45 KB
|
|
30
|
-
ESM dist/proposals/index.js 146.00 B
|
|
31
|
-
ESM dist/realtime/index.js 31.00 B
|
|
32
|
-
ESM dist/preferences/index.js 374.00 B
|
|
33
|
-
ESM dist/chunk-II4ANI46.js 175.00 B
|
|
34
|
-
ESM ⚡️ Build success in 74ms
|
|
35
|
-
DTS Build start
|
|
36
|
-
DTS ⚡️ Build success in 15351ms
|
|
37
|
-
DTS dist/documents/index.d.ts 224.00 B
|
|
38
|
-
DTS dist/events/index.d.ts 4.12 KB
|
|
39
|
-
DTS dist/proposals/index.d.ts 1.23 KB
|
|
40
|
-
DTS dist/realtime/index.d.ts 1.54 KB
|
|
41
|
-
DTS dist/relations/index.d.ts 896.00 B
|
|
42
|
-
DTS dist/workspaces/index.d.ts 882.00 B
|
|
43
|
-
DTS dist/preferences/index.d.ts 20.10 KB
|
|
44
|
-
DTS dist/views/index.d.ts 60.75 KB
|
|
45
|
-
DTS dist/index.d.ts 233.26 KB
|
|
46
|
-
DTS dist/entities/index.d.ts 1.20 KB
|
|
47
|
-
DTS dist/users/index.d.ts 195.00 B
|
|
48
|
-
DTS dist/inbox/index.d.ts 13.00 B
|
|
49
|
-
DTS dist/types-O93mCz6a.d.ts 31.09 KB
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> @synap-core/types@1.2.20 build /Users/antoine/Documents/Code/synap/synap-backend/packages/types
|
|
4
|
+
> tsup
|
|
5
|
+
|
|
6
|
+
[34mCLI[39m Building entry: src/index.ts
|
|
7
|
+
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
8
|
+
[34mCLI[39m tsup v8.5.1
|
|
9
|
+
[34mCLI[39m Using tsup config: /Users/antoine/Documents/Code/synap/synap-backend/packages/types/tsup.config.ts
|
|
10
|
+
[34mCLI[39m Target: es2022
|
|
11
|
+
[34mCLI[39m Cleaning output folder
|
|
12
|
+
[34mESM[39m Build start
|
|
13
|
+
[32mESM[39m [1mdist/index.js [22m[32m82.72 KB[39m
|
|
14
|
+
[32mESM[39m ⚡️ Build success in 108ms
|
|
15
|
+
DTS Build start
|
|
16
|
+
[41m[30m ELIFECYCLE [39m[49m [31mCommand failed.[39m
|
|
File without changes
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// src/preferences/schemas.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var CustomThemeSchema = z.object({
|
|
4
|
+
colors: z.object({
|
|
5
|
+
primary: z.string().optional(),
|
|
6
|
+
accent: z.string().optional(),
|
|
7
|
+
background: z.string().optional(),
|
|
8
|
+
border: z.string().optional(),
|
|
9
|
+
text: z.string().optional()
|
|
10
|
+
}).optional(),
|
|
11
|
+
spacing: z.object({
|
|
12
|
+
small: z.string().optional(),
|
|
13
|
+
medium: z.string().optional(),
|
|
14
|
+
large: z.string().optional()
|
|
15
|
+
}).optional(),
|
|
16
|
+
radii: z.object({
|
|
17
|
+
small: z.string().optional(),
|
|
18
|
+
medium: z.string().optional(),
|
|
19
|
+
large: z.string().optional()
|
|
20
|
+
}).optional(),
|
|
21
|
+
animations: z.object({
|
|
22
|
+
enabled: z.boolean().optional(),
|
|
23
|
+
speed: z.enum(["slow", "normal", "fast"]).optional()
|
|
24
|
+
}).optional()
|
|
25
|
+
}).optional();
|
|
26
|
+
var UIPreferencesSchema = z.object({
|
|
27
|
+
sidebarCollapsed: z.boolean().optional(),
|
|
28
|
+
panelPositions: z.record(
|
|
29
|
+
z.string(),
|
|
30
|
+
z.object({
|
|
31
|
+
x: z.number(),
|
|
32
|
+
y: z.number()
|
|
33
|
+
})
|
|
34
|
+
).optional(),
|
|
35
|
+
lastActiveView: z.string().optional(),
|
|
36
|
+
compactMode: z.boolean().optional(),
|
|
37
|
+
fontSize: z.string().optional(),
|
|
38
|
+
animations: z.boolean().optional(),
|
|
39
|
+
defaultView: z.enum(["list", "grid", "timeline"]).optional()
|
|
40
|
+
}).optional();
|
|
41
|
+
var GraphPreferencesSchema = z.object({
|
|
42
|
+
forceSettings: z.object({
|
|
43
|
+
linkDistance: z.number().optional(),
|
|
44
|
+
chargeStrength: z.number().optional(),
|
|
45
|
+
alphaDecay: z.number().optional(),
|
|
46
|
+
velocityDecay: z.number().optional()
|
|
47
|
+
}).optional(),
|
|
48
|
+
defaultFilters: z.object({
|
|
49
|
+
entityTypes: z.array(z.string()).optional(),
|
|
50
|
+
relationTypes: z.array(z.string()).optional()
|
|
51
|
+
}).optional(),
|
|
52
|
+
zoom: z.number().optional(),
|
|
53
|
+
pan: z.object({
|
|
54
|
+
x: z.number(),
|
|
55
|
+
y: z.number()
|
|
56
|
+
}).optional(),
|
|
57
|
+
showMinimap: z.boolean().optional()
|
|
58
|
+
}).optional();
|
|
59
|
+
var UpdatePreferencesInputSchema = z.object({
|
|
60
|
+
theme: z.enum(["light", "dark", "system"]).optional(),
|
|
61
|
+
customTheme: CustomThemeSchema,
|
|
62
|
+
defaultTemplates: z.record(z.string(), z.string()).optional(),
|
|
63
|
+
customEntityTypes: z.array(z.any()).optional(),
|
|
64
|
+
entityMetadataSchemas: z.record(z.string(), z.record(z.string(), z.any())).optional(),
|
|
65
|
+
uiPreferences: UIPreferencesSchema,
|
|
66
|
+
graphPreferences: GraphPreferencesSchema,
|
|
67
|
+
onboardingCompleted: z.boolean().optional(),
|
|
68
|
+
onboardingStep: z.string().optional()
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
export {
|
|
72
|
+
CustomThemeSchema,
|
|
73
|
+
UIPreferencesSchema,
|
|
74
|
+
GraphPreferencesSchema,
|
|
75
|
+
UpdatePreferencesInputSchema
|
|
76
|
+
};
|
|
File without changes
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
// src/entities/schemas.ts
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
var ENTITY_SCHEMAS = {
|
|
4
|
+
task: z.object({
|
|
5
|
+
status: z.enum(["todo", "in_progress", "done", "archived"]).default("todo"),
|
|
6
|
+
priority: z.enum(["low", "medium", "high", "urgent"]).optional(),
|
|
7
|
+
dueDate: z.string().datetime().optional(),
|
|
8
|
+
completedAt: z.string().datetime().optional(),
|
|
9
|
+
assignee: z.string().uuid().optional(),
|
|
10
|
+
estimatedMinutes: z.number().int().positive().optional(),
|
|
11
|
+
actualMinutes: z.number().int().positive().optional()
|
|
12
|
+
}),
|
|
13
|
+
note: z.object({
|
|
14
|
+
tags: z.array(z.string()).default([]),
|
|
15
|
+
format: z.enum(["markdown", "plain", "rich"]).default("markdown"),
|
|
16
|
+
linkedEntities: z.array(z.string().uuid()).optional(),
|
|
17
|
+
isFavorite: z.boolean().default(false)
|
|
18
|
+
}),
|
|
19
|
+
person: z.object({
|
|
20
|
+
email: z.string().email().optional(),
|
|
21
|
+
phone: z.string().optional(),
|
|
22
|
+
company: z.string().optional(),
|
|
23
|
+
role: z.string().optional(),
|
|
24
|
+
linkedInUrl: z.string().url().optional(),
|
|
25
|
+
twitterHandle: z.string().optional(),
|
|
26
|
+
notes: z.string().optional()
|
|
27
|
+
}),
|
|
28
|
+
event: z.object({
|
|
29
|
+
startTime: z.string().datetime(),
|
|
30
|
+
endTime: z.string().datetime(),
|
|
31
|
+
location: z.string().optional(),
|
|
32
|
+
attendees: z.array(z.string().uuid()).optional(),
|
|
33
|
+
recurring: z.boolean().default(false),
|
|
34
|
+
recurrenceRule: z.string().optional(),
|
|
35
|
+
// iCal RRULE format
|
|
36
|
+
isAllDay: z.boolean().default(false),
|
|
37
|
+
reminderMinutes: z.number().int().optional()
|
|
38
|
+
}),
|
|
39
|
+
file: z.object({
|
|
40
|
+
mimeType: z.string(),
|
|
41
|
+
sizeBytes: z.number().int().positive(),
|
|
42
|
+
extension: z.string(),
|
|
43
|
+
thumbnailUrl: z.string().url().optional(),
|
|
44
|
+
downloadUrl: z.string().url().optional()
|
|
45
|
+
}),
|
|
46
|
+
code: z.object({
|
|
47
|
+
language: z.string(),
|
|
48
|
+
snippet: z.string().optional()
|
|
49
|
+
}),
|
|
50
|
+
bookmark: z.object({
|
|
51
|
+
url: z.string().url(),
|
|
52
|
+
favicon: z.string().optional()
|
|
53
|
+
}),
|
|
54
|
+
company: z.object({
|
|
55
|
+
website: z.string().url().optional(),
|
|
56
|
+
industry: z.string().optional(),
|
|
57
|
+
foundedYear: z.number().int().optional()
|
|
58
|
+
}),
|
|
59
|
+
// Aliases/New types for API compatibility
|
|
60
|
+
contact: z.object({
|
|
61
|
+
email: z.string().email().optional(),
|
|
62
|
+
phone: z.string().optional(),
|
|
63
|
+
company: z.string().optional(),
|
|
64
|
+
role: z.string().optional(),
|
|
65
|
+
linkedInUrl: z.string().url().optional(),
|
|
66
|
+
twitterHandle: z.string().optional(),
|
|
67
|
+
notes: z.string().optional()
|
|
68
|
+
}),
|
|
69
|
+
meeting: z.object({
|
|
70
|
+
startTime: z.string().datetime(),
|
|
71
|
+
endTime: z.string().datetime(),
|
|
72
|
+
location: z.string().optional(),
|
|
73
|
+
attendees: z.array(z.string().uuid()).optional(),
|
|
74
|
+
recurring: z.boolean().default(false),
|
|
75
|
+
recurrenceRule: z.string().optional(),
|
|
76
|
+
isAllDay: z.boolean().default(false),
|
|
77
|
+
reminderMinutes: z.number().int().optional()
|
|
78
|
+
}),
|
|
79
|
+
idea: z.object({
|
|
80
|
+
tags: z.array(z.string()).default([]),
|
|
81
|
+
impact: z.enum(["low", "medium", "high"]).optional(),
|
|
82
|
+
effort: z.enum(["low", "medium", "high"]).optional()
|
|
83
|
+
}),
|
|
84
|
+
project: z.object({
|
|
85
|
+
status: z.enum(["active", "on_hold", "completed", "archived"]).default("active"),
|
|
86
|
+
priority: z.enum(["low", "medium", "high", "urgent"]).optional(),
|
|
87
|
+
dueDate: z.string().datetime().optional(),
|
|
88
|
+
completedAt: z.string().datetime().optional(),
|
|
89
|
+
owner: z.string().uuid().optional()
|
|
90
|
+
})
|
|
91
|
+
};
|
|
92
|
+
function validateEntityMetadata(type, metadata) {
|
|
93
|
+
return ENTITY_SCHEMAS[type].parse(metadata);
|
|
94
|
+
}
|
|
95
|
+
function safeValidateEntityMetadata(type, metadata) {
|
|
96
|
+
return ENTITY_SCHEMAS[type].safeParse(metadata);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// src/entities/types.ts
|
|
100
|
+
import { z as z2 } from "zod";
|
|
101
|
+
var baseEntitySchema = z2.object({
|
|
102
|
+
id: z2.string(),
|
|
103
|
+
userId: z2.string(),
|
|
104
|
+
workspaceId: z2.string().nullable(),
|
|
105
|
+
type: z2.string(),
|
|
106
|
+
title: z2.string().nullable(),
|
|
107
|
+
preview: z2.string().nullable(),
|
|
108
|
+
documentId: z2.string().nullable(),
|
|
109
|
+
metadata: z2.any(),
|
|
110
|
+
fileUrl: z2.string().nullable(),
|
|
111
|
+
filePath: z2.string().nullable(),
|
|
112
|
+
fileSize: z2.number().nullable(),
|
|
113
|
+
fileType: z2.string().nullable(),
|
|
114
|
+
checksum: z2.string().nullable(),
|
|
115
|
+
projectIds: z2.array(z2.string()).nullable(),
|
|
116
|
+
version: z2.number(),
|
|
117
|
+
createdAt: z2.date(),
|
|
118
|
+
updatedAt: z2.date(),
|
|
119
|
+
deletedAt: z2.date().nullable()
|
|
120
|
+
});
|
|
121
|
+
var EntitySchema = z2.discriminatedUnion("type", [
|
|
122
|
+
baseEntitySchema.extend({
|
|
123
|
+
type: z2.literal("task"),
|
|
124
|
+
metadata: ENTITY_SCHEMAS.task
|
|
125
|
+
}),
|
|
126
|
+
baseEntitySchema.extend({
|
|
127
|
+
type: z2.literal("note"),
|
|
128
|
+
metadata: ENTITY_SCHEMAS.note
|
|
129
|
+
}),
|
|
130
|
+
baseEntitySchema.extend({
|
|
131
|
+
type: z2.literal("person"),
|
|
132
|
+
metadata: ENTITY_SCHEMAS.person
|
|
133
|
+
}),
|
|
134
|
+
baseEntitySchema.extend({
|
|
135
|
+
type: z2.literal("event"),
|
|
136
|
+
metadata: ENTITY_SCHEMAS.event
|
|
137
|
+
}),
|
|
138
|
+
baseEntitySchema.extend({
|
|
139
|
+
type: z2.literal("file"),
|
|
140
|
+
metadata: ENTITY_SCHEMAS.file
|
|
141
|
+
}),
|
|
142
|
+
baseEntitySchema.extend({
|
|
143
|
+
type: z2.literal("code"),
|
|
144
|
+
metadata: ENTITY_SCHEMAS.code
|
|
145
|
+
}),
|
|
146
|
+
baseEntitySchema.extend({
|
|
147
|
+
type: z2.literal("bookmark"),
|
|
148
|
+
metadata: ENTITY_SCHEMAS.bookmark
|
|
149
|
+
}),
|
|
150
|
+
baseEntitySchema.extend({
|
|
151
|
+
type: z2.literal("company"),
|
|
152
|
+
metadata: ENTITY_SCHEMAS.company
|
|
153
|
+
}),
|
|
154
|
+
baseEntitySchema.extend({
|
|
155
|
+
type: z2.literal("contact"),
|
|
156
|
+
metadata: ENTITY_SCHEMAS.contact
|
|
157
|
+
}),
|
|
158
|
+
baseEntitySchema.extend({
|
|
159
|
+
type: z2.literal("meeting"),
|
|
160
|
+
metadata: ENTITY_SCHEMAS.meeting
|
|
161
|
+
}),
|
|
162
|
+
baseEntitySchema.extend({
|
|
163
|
+
type: z2.literal("idea"),
|
|
164
|
+
metadata: ENTITY_SCHEMAS.idea
|
|
165
|
+
}),
|
|
166
|
+
baseEntitySchema.extend({
|
|
167
|
+
type: z2.literal("project"),
|
|
168
|
+
metadata: ENTITY_SCHEMAS.project
|
|
169
|
+
})
|
|
170
|
+
]);
|
|
171
|
+
|
|
172
|
+
// src/entities/guards.ts
|
|
173
|
+
function isTask(entity) {
|
|
174
|
+
return entity.type === "task";
|
|
175
|
+
}
|
|
176
|
+
function isNote(entity) {
|
|
177
|
+
return entity.type === "note";
|
|
178
|
+
}
|
|
179
|
+
function isPerson(entity) {
|
|
180
|
+
return entity.type === "person";
|
|
181
|
+
}
|
|
182
|
+
function isEvent(entity) {
|
|
183
|
+
return entity.type === "event";
|
|
184
|
+
}
|
|
185
|
+
function isFile(entity) {
|
|
186
|
+
return entity.type === "file";
|
|
187
|
+
}
|
|
188
|
+
function isEntityOfType(entity, type) {
|
|
189
|
+
return entity.type === type;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export {
|
|
193
|
+
ENTITY_SCHEMAS,
|
|
194
|
+
validateEntityMetadata,
|
|
195
|
+
safeValidateEntityMetadata,
|
|
196
|
+
EntitySchema,
|
|
197
|
+
isTask,
|
|
198
|
+
isNote,
|
|
199
|
+
isPerson,
|
|
200
|
+
isEvent,
|
|
201
|
+
isFile,
|
|
202
|
+
isEntityOfType
|
|
203
|
+
};
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
// src/views/types.ts
|
|
2
|
+
var VIEW_TYPE_CATEGORIES = {
|
|
3
|
+
// Structured (query-based, interchangeable layouts)
|
|
4
|
+
table: "structured",
|
|
5
|
+
kanban: "structured",
|
|
6
|
+
list: "structured",
|
|
7
|
+
grid: "structured",
|
|
8
|
+
gallery: "structured",
|
|
9
|
+
calendar: "structured",
|
|
10
|
+
gantt: "structured",
|
|
11
|
+
timeline: "structured",
|
|
12
|
+
graph: "structured",
|
|
13
|
+
// Graph is also query-based!
|
|
14
|
+
// Canvas (freeform drawing)
|
|
15
|
+
whiteboard: "canvas",
|
|
16
|
+
mindmap: "canvas"
|
|
17
|
+
};
|
|
18
|
+
function getViewCategory(type) {
|
|
19
|
+
return VIEW_TYPE_CATEGORIES[type];
|
|
20
|
+
}
|
|
21
|
+
function isStructuredContent(content) {
|
|
22
|
+
return content.category === "structured";
|
|
23
|
+
}
|
|
24
|
+
function isCanvasContent(content) {
|
|
25
|
+
return content.category === "canvas";
|
|
26
|
+
}
|
|
27
|
+
function getContentCategoryForViewType(type) {
|
|
28
|
+
return VIEW_TYPE_CATEGORIES[type];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// src/views/schemas.ts
|
|
32
|
+
import { z } from "zod";
|
|
33
|
+
var EntityFilterSchema = z.object({
|
|
34
|
+
field: z.string(),
|
|
35
|
+
operator: z.enum([
|
|
36
|
+
"equals",
|
|
37
|
+
"contains",
|
|
38
|
+
"gt",
|
|
39
|
+
"gte",
|
|
40
|
+
"lt",
|
|
41
|
+
"lte",
|
|
42
|
+
"in",
|
|
43
|
+
"notIn",
|
|
44
|
+
"between"
|
|
45
|
+
]),
|
|
46
|
+
value: z.unknown()
|
|
47
|
+
});
|
|
48
|
+
var SortRuleSchema = z.object({
|
|
49
|
+
field: z.string(),
|
|
50
|
+
direction: z.enum(["asc", "desc"])
|
|
51
|
+
});
|
|
52
|
+
var EntityQuerySchema = z.object({
|
|
53
|
+
entityTypes: z.array(z.string()).optional(),
|
|
54
|
+
entityIds: z.array(z.string().uuid()).optional(),
|
|
55
|
+
filters: z.array(EntityFilterSchema).optional(),
|
|
56
|
+
sorts: z.array(SortRuleSchema).optional(),
|
|
57
|
+
search: z.string().optional(),
|
|
58
|
+
limit: z.number().int().positive().max(1e3).optional(),
|
|
59
|
+
offset: z.number().int().nonnegative().optional(),
|
|
60
|
+
groupBy: z.string().optional()
|
|
61
|
+
});
|
|
62
|
+
var KanbanColumnSchema = z.object({
|
|
63
|
+
id: z.string(),
|
|
64
|
+
value: z.string(),
|
|
65
|
+
label: z.string(),
|
|
66
|
+
order: z.number(),
|
|
67
|
+
color: z.string().optional(),
|
|
68
|
+
limit: z.number().optional()
|
|
69
|
+
});
|
|
70
|
+
var RenderSettingsSchema = z.object({
|
|
71
|
+
layout: z.enum([
|
|
72
|
+
"table",
|
|
73
|
+
"kanban",
|
|
74
|
+
"list",
|
|
75
|
+
"grid",
|
|
76
|
+
"gallery",
|
|
77
|
+
"calendar",
|
|
78
|
+
"gantt",
|
|
79
|
+
"timeline",
|
|
80
|
+
"graph"
|
|
81
|
+
]).optional(),
|
|
82
|
+
// Common fields (flexible to allow frontend-specific structures)
|
|
83
|
+
columns: z.array(z.any()).optional(),
|
|
84
|
+
filters: z.array(z.any()).optional(),
|
|
85
|
+
// Legacy UI filters
|
|
86
|
+
sorts: z.array(z.any()).optional(),
|
|
87
|
+
// Legacy UI sorts
|
|
88
|
+
groupByColumnId: z.string().optional(),
|
|
89
|
+
// Layout-specific fields
|
|
90
|
+
kanbanColumns: z.array(KanbanColumnSchema).optional(),
|
|
91
|
+
calendarDateField: z.string().optional(),
|
|
92
|
+
timelineTimeField: z.string().optional(),
|
|
93
|
+
graphLayout: z.enum(["force", "hierarchical", "circular"]).optional(),
|
|
94
|
+
graphRelationshipTypes: z.array(z.string()).optional()
|
|
95
|
+
}).passthrough();
|
|
96
|
+
var StructuredViewConfigSchema = z.object({
|
|
97
|
+
category: z.literal("structured"),
|
|
98
|
+
query: EntityQuerySchema,
|
|
99
|
+
render: RenderSettingsSchema.optional()
|
|
100
|
+
});
|
|
101
|
+
var StructuredViewContentSchema = z.object({
|
|
102
|
+
version: z.literal(1),
|
|
103
|
+
category: z.literal("structured"),
|
|
104
|
+
// We use the StructuredViewConfigSchema but unwrap it or use it as part of the content
|
|
105
|
+
// Actually, ViewContent usually IS the config for structured views
|
|
106
|
+
query: EntityQuerySchema,
|
|
107
|
+
render: RenderSettingsSchema.optional()
|
|
108
|
+
}).passthrough();
|
|
109
|
+
var CanvasViewContentSchema = z.object({
|
|
110
|
+
version: z.literal(1),
|
|
111
|
+
category: z.literal("canvas"),
|
|
112
|
+
elements: z.array(z.unknown()),
|
|
113
|
+
embeddedEntities: z.array(z.string().uuid()).optional()
|
|
114
|
+
});
|
|
115
|
+
var ViewContentSchema = z.discriminatedUnion("category", [
|
|
116
|
+
StructuredViewContentSchema,
|
|
117
|
+
CanvasViewContentSchema
|
|
118
|
+
]);
|
|
119
|
+
function parseViewContent(raw) {
|
|
120
|
+
return ViewContentSchema.parse(raw);
|
|
121
|
+
}
|
|
122
|
+
function safeParseViewContent(raw) {
|
|
123
|
+
return ViewContentSchema.safeParse(raw);
|
|
124
|
+
}
|
|
125
|
+
function validateContentCategoryForViewType(viewType, content) {
|
|
126
|
+
const canvasTypes = ["whiteboard", "mindmap"];
|
|
127
|
+
const expectedCategory = canvasTypes.includes(viewType) ? "canvas" : "structured";
|
|
128
|
+
return content.category === expectedCategory;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export {
|
|
132
|
+
VIEW_TYPE_CATEGORIES,
|
|
133
|
+
getViewCategory,
|
|
134
|
+
isStructuredContent,
|
|
135
|
+
isCanvasContent,
|
|
136
|
+
getContentCategoryForViewType,
|
|
137
|
+
EntityQuerySchema,
|
|
138
|
+
RenderSettingsSchema,
|
|
139
|
+
StructuredViewConfigSchema,
|
|
140
|
+
ViewContentSchema,
|
|
141
|
+
parseViewContent,
|
|
142
|
+
safeParseViewContent,
|
|
143
|
+
validateContentCategoryForViewType
|
|
144
|
+
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|