@synap-core/types 0.4.0 → 1.2.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/.turbo/turbo-build.log +33 -16
- package/dist/chunk-5MS6TR4O.js +124 -0
- package/dist/chunk-75HLKBPD.js +81 -0
- package/dist/{chunk-RIUK6OEK.js → chunk-E57ULMXU.js} +41 -35
- package/dist/chunk-WXJ4PQR7.js +22 -0
- package/dist/documents/index.d.ts +1 -64
- package/dist/documents/index.js +20 -1
- package/dist/entities/index.d.ts +4 -431
- package/dist/entities/index.js +3 -1
- package/dist/events/index.d.ts +18 -1
- package/dist/events/index.js +12 -3
- package/dist/inbox/index.d.ts +1 -165
- package/dist/inbox/index.js +1 -12
- package/dist/index.d.ts +5487 -10
- package/dist/index.js +709 -20
- package/dist/preferences/index.d.ts +573 -25
- package/dist/preferences/index.js +16 -1
- package/dist/relations/index.d.ts +8 -21
- package/dist/types-nhCcewMV.d.ts +996 -0
- package/dist/users/index.d.ts +1 -67
- package/dist/views/index.d.ts +1561 -96
- package/dist/views/index.js +28 -1
- package/dist/workspaces/index.d.ts +10 -49
- package/package.json +25 -4
- package/src/approvals/index.ts +147 -0
- package/src/chat/index.ts +160 -0
- package/src/documents/index.ts +23 -64
- package/src/entities/schemas.ts +12 -33
- package/src/entities/types.ts +58 -34
- package/src/errors/index.ts +255 -0
- package/src/events/index.ts +16 -0
- package/src/hub-protocol/index.ts +282 -0
- package/src/inbox/index.ts +0 -121
- package/src/index.ts +25 -10
- package/src/preferences/index.ts +35 -27
- package/src/preferences/schemas.ts +87 -0
- package/src/relations/index.ts +10 -27
- package/src/templates/classic-note.template.ts +107 -0
- package/src/templates/index.ts +65 -0
- package/src/templates/notion-like.template.ts +138 -0
- package/src/templates/schemas.ts +181 -0
- package/src/templates/types.ts +227 -0
- package/src/templates/wiki-reference.template.ts +120 -0
- package/src/users/index.ts +14 -68
- package/src/views/config.ts +129 -0
- package/src/views/index.ts +30 -166
- package/src/views/query.ts +78 -0
- package/src/views/schema.ts +36 -0
- package/src/views/schemas.ts +173 -0
- package/src/views/types.ts +201 -0
- package/src/workspaces/index.ts +18 -54
- package/dist/chunk-6OHYLFUB.js +0 -16
- package/dist/chunk-7LKCNZXD.js +0 -0
- package/dist/chunk-ZFFMXKF2.js +0 -49
- package/dist/chunk-ZTGPGYVX.js +0 -0
- /package/dist/{chunk-2BEUWD3P.js → chunk-GX24H4PF.js} +0 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,29 +1,46 @@
|
|
|
1
1
|
|
|
2
|
-
> @synap-core/types@
|
|
2
|
+
> @synap-core/types@1.0.0 build /Users/antoine/Documents/Code/synap/synap-backend/packages/types
|
|
3
3
|
> tsup
|
|
4
4
|
|
|
5
|
-
CLI Building entry: src/index.ts, src/documents/index.ts, src/entities/index.ts, src/inbox/index.ts, src/preferences/index.ts, src/
|
|
5
|
+
CLI Building entry: src/index.ts, src/documents/index.ts, src/entities/index.ts, src/events/index.ts, src/inbox/index.ts, src/preferences/index.ts, src/relations/index.ts, src/users/index.ts, src/realtime/index.ts, src/views/index.ts, src/workspaces/index.ts
|
|
6
6
|
CLI Using tsconfig: tsconfig.json
|
|
7
7
|
CLI tsup v8.5.1
|
|
8
8
|
CLI Using tsup config: /Users/antoine/Documents/Code/synap/synap-backend/packages/types/tsup.config.ts
|
|
9
9
|
CLI Target: es2022
|
|
10
10
|
CLI Cleaning output folder
|
|
11
11
|
ESM Build start
|
|
12
|
-
ESM dist/chunk-7LKCNZXD.js 0 B
|
|
13
|
-
ESM dist/chunk-IZA3UKBT.js 0 B
|
|
14
|
-
ESM dist/chunk-2BEUWD3P.js 0 B
|
|
15
12
|
ESM dist/chunk-X5L3VJJZ.js 0 B
|
|
13
|
+
ESM dist/chunk-IZA3UKBT.js 0 B
|
|
14
|
+
ESM dist/chunk-QAWJ6GM3.js 0 B
|
|
15
|
+
ESM dist/chunk-GX24H4PF.js 0 B
|
|
16
|
+
ESM dist/realtime/index.js 31.00 B
|
|
17
|
+
ESM dist/views/index.js 642.00 B
|
|
16
18
|
ESM dist/chunk-2N5ZC5EB.js 0 B
|
|
17
|
-
ESM dist/chunk-ZTGPGYVX.js 0 B
|
|
18
|
-
ESM dist/index.js 717.00 B
|
|
19
|
-
ESM dist/documents/index.js 31.00 B
|
|
20
19
|
ESM dist/workspaces/index.js 31.00 B
|
|
21
|
-
ESM dist/
|
|
22
|
-
ESM dist/
|
|
23
|
-
ESM dist/
|
|
24
|
-
ESM dist/
|
|
20
|
+
ESM dist/chunk-5MS6TR4O.js 3.86 KB
|
|
21
|
+
ESM dist/index.js 19.08 KB
|
|
22
|
+
ESM dist/events/index.js 405.00 B
|
|
23
|
+
ESM dist/documents/index.js 522.00 B
|
|
24
|
+
ESM dist/preferences/index.js 374.00 B
|
|
25
|
+
ESM dist/chunk-E57ULMXU.js 4.07 KB
|
|
26
|
+
ESM dist/chunk-WXJ4PQR7.js 551.00 B
|
|
27
|
+
ESM dist/relations/index.js 31.00 B
|
|
28
|
+
ESM dist/entities/index.js 372.00 B
|
|
29
|
+
ESM dist/chunk-75HLKBPD.js 2.44 KB
|
|
25
30
|
ESM dist/users/index.js 31.00 B
|
|
26
|
-
ESM dist/
|
|
27
|
-
ESM
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
ESM dist/inbox/index.js 31.00 B
|
|
32
|
+
ESM ⚡️ Build success in 24ms
|
|
33
|
+
DTS Build start
|
|
34
|
+
DTS ⚡️ Build success in 10302ms
|
|
35
|
+
DTS dist/documents/index.d.ts 397.00 B
|
|
36
|
+
DTS dist/events/index.d.ts 4.12 KB
|
|
37
|
+
DTS dist/relations/index.d.ts 896.00 B
|
|
38
|
+
DTS dist/realtime/index.d.ts 1.54 KB
|
|
39
|
+
DTS dist/workspaces/index.d.ts 882.00 B
|
|
40
|
+
DTS dist/preferences/index.d.ts 20.10 KB
|
|
41
|
+
DTS dist/views/index.d.ts 60.75 KB
|
|
42
|
+
DTS dist/index.d.ts 233.31 KB
|
|
43
|
+
DTS dist/entities/index.d.ts 1.20 KB
|
|
44
|
+
DTS dist/users/index.d.ts 195.00 B
|
|
45
|
+
DTS dist/inbox/index.d.ts 13.00 B
|
|
46
|
+
DTS dist/types-nhCcewMV.d.ts 30.52 KB
|
|
@@ -0,0 +1,124 @@
|
|
|
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(["equals", "contains", "gt", "gte", "lt", "lte", "in", "notIn", "between"]),
|
|
36
|
+
value: z.unknown()
|
|
37
|
+
});
|
|
38
|
+
var SortRuleSchema = z.object({
|
|
39
|
+
field: z.string(),
|
|
40
|
+
direction: z.enum(["asc", "desc"])
|
|
41
|
+
});
|
|
42
|
+
var EntityQuerySchema = z.object({
|
|
43
|
+
entityTypes: z.array(z.string()).optional(),
|
|
44
|
+
entityIds: z.array(z.string().uuid()).optional(),
|
|
45
|
+
filters: z.array(EntityFilterSchema).optional(),
|
|
46
|
+
sorts: z.array(SortRuleSchema).optional(),
|
|
47
|
+
search: z.string().optional(),
|
|
48
|
+
limit: z.number().int().positive().max(1e3).optional(),
|
|
49
|
+
offset: z.number().int().nonnegative().optional(),
|
|
50
|
+
groupBy: z.string().optional()
|
|
51
|
+
});
|
|
52
|
+
var KanbanColumnSchema = z.object({
|
|
53
|
+
id: z.string(),
|
|
54
|
+
value: z.string(),
|
|
55
|
+
label: z.string(),
|
|
56
|
+
order: z.number(),
|
|
57
|
+
color: z.string().optional(),
|
|
58
|
+
limit: z.number().optional()
|
|
59
|
+
});
|
|
60
|
+
var RenderSettingsSchema = z.object({
|
|
61
|
+
layout: z.enum(["table", "kanban", "list", "grid", "gallery", "calendar", "gantt", "timeline", "graph"]).optional(),
|
|
62
|
+
// Common fields (flexible to allow frontend-specific structures)
|
|
63
|
+
columns: z.array(z.any()).optional(),
|
|
64
|
+
filters: z.array(z.any()).optional(),
|
|
65
|
+
// Legacy UI filters
|
|
66
|
+
sorts: z.array(z.any()).optional(),
|
|
67
|
+
// Legacy UI sorts
|
|
68
|
+
groupByColumnId: z.string().optional(),
|
|
69
|
+
// Layout-specific fields
|
|
70
|
+
kanbanColumns: z.array(KanbanColumnSchema).optional(),
|
|
71
|
+
calendarDateField: z.string().optional(),
|
|
72
|
+
timelineTimeField: z.string().optional(),
|
|
73
|
+
graphLayout: z.enum(["force", "hierarchical", "circular"]).optional(),
|
|
74
|
+
graphRelationshipTypes: z.array(z.string()).optional()
|
|
75
|
+
}).passthrough();
|
|
76
|
+
var StructuredViewConfigSchema = z.object({
|
|
77
|
+
category: z.literal("structured"),
|
|
78
|
+
query: EntityQuerySchema,
|
|
79
|
+
render: RenderSettingsSchema.optional()
|
|
80
|
+
});
|
|
81
|
+
var StructuredViewContentSchema = z.object({
|
|
82
|
+
version: z.literal(1),
|
|
83
|
+
category: z.literal("structured"),
|
|
84
|
+
// We use the StructuredViewConfigSchema but unwrap it or use it as part of the content
|
|
85
|
+
// Actually, ViewContent usually IS the config for structured views
|
|
86
|
+
query: EntityQuerySchema,
|
|
87
|
+
render: RenderSettingsSchema.optional()
|
|
88
|
+
}).passthrough();
|
|
89
|
+
var CanvasViewContentSchema = z.object({
|
|
90
|
+
version: z.literal(1),
|
|
91
|
+
category: z.literal("canvas"),
|
|
92
|
+
elements: z.array(z.unknown()),
|
|
93
|
+
embeddedEntities: z.array(z.string().uuid()).optional()
|
|
94
|
+
});
|
|
95
|
+
var ViewContentSchema = z.discriminatedUnion("category", [
|
|
96
|
+
StructuredViewContentSchema,
|
|
97
|
+
CanvasViewContentSchema
|
|
98
|
+
]);
|
|
99
|
+
function parseViewContent(raw) {
|
|
100
|
+
return ViewContentSchema.parse(raw);
|
|
101
|
+
}
|
|
102
|
+
function safeParseViewContent(raw) {
|
|
103
|
+
return ViewContentSchema.safeParse(raw);
|
|
104
|
+
}
|
|
105
|
+
function validateContentCategoryForViewType(viewType, content) {
|
|
106
|
+
const canvasTypes = ["whiteboard", "mindmap"];
|
|
107
|
+
const expectedCategory = canvasTypes.includes(viewType) ? "canvas" : "structured";
|
|
108
|
+
return content.category === expectedCategory;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export {
|
|
112
|
+
VIEW_TYPE_CATEGORIES,
|
|
113
|
+
getViewCategory,
|
|
114
|
+
isStructuredContent,
|
|
115
|
+
isCanvasContent,
|
|
116
|
+
getContentCategoryForViewType,
|
|
117
|
+
EntityQuerySchema,
|
|
118
|
+
RenderSettingsSchema,
|
|
119
|
+
StructuredViewConfigSchema,
|
|
120
|
+
ViewContentSchema,
|
|
121
|
+
parseViewContent,
|
|
122
|
+
safeParseViewContent,
|
|
123
|
+
validateContentCategoryForViewType
|
|
124
|
+
};
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// src/preferences/index.ts
|
|
2
|
+
import {
|
|
3
|
+
insertUserPreferenceSchema,
|
|
4
|
+
selectUserPreferenceSchema
|
|
5
|
+
} from "@synap/database/schema";
|
|
6
|
+
|
|
7
|
+
// src/preferences/schemas.ts
|
|
8
|
+
import { z } from "zod";
|
|
9
|
+
var CustomThemeSchema = z.object({
|
|
10
|
+
colors: z.object({
|
|
11
|
+
primary: z.string().optional(),
|
|
12
|
+
accent: z.string().optional(),
|
|
13
|
+
background: z.string().optional(),
|
|
14
|
+
border: z.string().optional(),
|
|
15
|
+
text: z.string().optional()
|
|
16
|
+
}).optional(),
|
|
17
|
+
spacing: z.object({
|
|
18
|
+
small: z.string().optional(),
|
|
19
|
+
medium: z.string().optional(),
|
|
20
|
+
large: z.string().optional()
|
|
21
|
+
}).optional(),
|
|
22
|
+
radii: z.object({
|
|
23
|
+
small: z.string().optional(),
|
|
24
|
+
medium: z.string().optional(),
|
|
25
|
+
large: z.string().optional()
|
|
26
|
+
}).optional(),
|
|
27
|
+
animations: z.object({
|
|
28
|
+
enabled: z.boolean().optional(),
|
|
29
|
+
speed: z.enum(["slow", "normal", "fast"]).optional()
|
|
30
|
+
}).optional()
|
|
31
|
+
}).optional();
|
|
32
|
+
var UIPreferencesSchema = z.object({
|
|
33
|
+
sidebarCollapsed: z.boolean().optional(),
|
|
34
|
+
panelPositions: z.record(z.object({
|
|
35
|
+
x: z.number(),
|
|
36
|
+
y: z.number()
|
|
37
|
+
})).optional(),
|
|
38
|
+
lastActiveView: z.string().optional(),
|
|
39
|
+
compactMode: z.boolean().optional(),
|
|
40
|
+
fontSize: z.string().optional(),
|
|
41
|
+
animations: z.boolean().optional(),
|
|
42
|
+
defaultView: z.enum(["list", "grid", "timeline"]).optional()
|
|
43
|
+
}).optional();
|
|
44
|
+
var GraphPreferencesSchema = z.object({
|
|
45
|
+
forceSettings: z.object({
|
|
46
|
+
linkDistance: z.number().optional(),
|
|
47
|
+
chargeStrength: z.number().optional(),
|
|
48
|
+
alphaDecay: z.number().optional(),
|
|
49
|
+
velocityDecay: z.number().optional()
|
|
50
|
+
}).optional(),
|
|
51
|
+
defaultFilters: z.object({
|
|
52
|
+
entityTypes: z.array(z.string()).optional(),
|
|
53
|
+
relationTypes: z.array(z.string()).optional()
|
|
54
|
+
}).optional(),
|
|
55
|
+
zoom: z.number().optional(),
|
|
56
|
+
pan: z.object({
|
|
57
|
+
x: z.number(),
|
|
58
|
+
y: z.number()
|
|
59
|
+
}).optional(),
|
|
60
|
+
showMinimap: z.boolean().optional()
|
|
61
|
+
}).optional();
|
|
62
|
+
var UpdatePreferencesInputSchema = z.object({
|
|
63
|
+
theme: z.enum(["light", "dark", "system"]).optional(),
|
|
64
|
+
customTheme: CustomThemeSchema,
|
|
65
|
+
defaultTemplates: z.record(z.string(), z.string()).optional(),
|
|
66
|
+
customEntityTypes: z.array(z.any()).optional(),
|
|
67
|
+
entityMetadataSchemas: z.record(z.string(), z.record(z.any())).optional(),
|
|
68
|
+
uiPreferences: UIPreferencesSchema,
|
|
69
|
+
graphPreferences: GraphPreferencesSchema,
|
|
70
|
+
onboardingCompleted: z.boolean().optional(),
|
|
71
|
+
onboardingStep: z.string().optional()
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
export {
|
|
75
|
+
CustomThemeSchema,
|
|
76
|
+
UIPreferencesSchema,
|
|
77
|
+
GraphPreferencesSchema,
|
|
78
|
+
UpdatePreferencesInputSchema,
|
|
79
|
+
insertUserPreferenceSchema,
|
|
80
|
+
selectUserPreferenceSchema
|
|
81
|
+
};
|
|
@@ -43,45 +43,18 @@ var ENTITY_SCHEMAS = {
|
|
|
43
43
|
thumbnailUrl: z.string().url().optional(),
|
|
44
44
|
downloadUrl: z.string().url().optional()
|
|
45
45
|
}),
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
industry: z.string().optional(),
|
|
50
|
-
size: z.enum(["startup", "small", "medium", "large", "enterprise"]).optional(),
|
|
51
|
-
location: z.string().optional(),
|
|
52
|
-
linkedInUrl: z.string().url().optional(),
|
|
53
|
-
description: z.string().optional(),
|
|
54
|
-
foundedYear: z.number().int().optional(),
|
|
55
|
-
// Linked employee person entities
|
|
56
|
-
employees: z.array(z.string().uuid()).default([])
|
|
46
|
+
code: z.object({
|
|
47
|
+
language: z.string(),
|
|
48
|
+
snippet: z.string().optional()
|
|
57
49
|
}),
|
|
58
|
-
// NEW: Bookmark/Web clip entity
|
|
59
50
|
bookmark: z.object({
|
|
60
51
|
url: z.string().url(),
|
|
61
|
-
favicon: z.string().
|
|
62
|
-
excerpt: z.string().optional(),
|
|
63
|
-
siteName: z.string().optional(),
|
|
64
|
-
author: z.string().optional(),
|
|
65
|
-
publishedDate: z.string().datetime().optional(),
|
|
66
|
-
tags: z.array(z.string()).default([]),
|
|
67
|
-
// For local archiving
|
|
68
|
-
archiveUrl: z.string().url().optional(),
|
|
69
|
-
isRead: z.boolean().default(false)
|
|
52
|
+
favicon: z.string().optional()
|
|
70
53
|
}),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
runtime: z.string().optional(),
|
|
76
|
-
// 'node', 'browser', 'python3', etc.
|
|
77
|
-
framework: z.string().optional(),
|
|
78
|
-
// 'react', 'express', 'django', etc.
|
|
79
|
-
dependencies: z.array(z.string()).default([]),
|
|
80
|
-
isExecutable: z.boolean().default(false),
|
|
81
|
-
sourceUrl: z.string().url().optional(),
|
|
82
|
-
// GitHub gist, CodeSandbox, etc.
|
|
83
|
-
version: z.string().optional()
|
|
84
|
-
// Code version/revision
|
|
54
|
+
company: z.object({
|
|
55
|
+
website: z.string().url().optional(),
|
|
56
|
+
industry: z.string().optional(),
|
|
57
|
+
foundedYear: z.number().int().optional()
|
|
85
58
|
})
|
|
86
59
|
};
|
|
87
60
|
function validateEntityMetadata(type, metadata) {
|
|
@@ -91,6 +64,38 @@ function safeValidateEntityMetadata(type, metadata) {
|
|
|
91
64
|
return ENTITY_SCHEMAS[type].safeParse(metadata);
|
|
92
65
|
}
|
|
93
66
|
|
|
67
|
+
// src/entities/types.ts
|
|
68
|
+
import { z as z2 } from "zod";
|
|
69
|
+
var baseEntitySchema = z2.object({
|
|
70
|
+
id: z2.string(),
|
|
71
|
+
userId: z2.string(),
|
|
72
|
+
workspaceId: z2.string().nullable(),
|
|
73
|
+
type: z2.string(),
|
|
74
|
+
title: z2.string().nullable(),
|
|
75
|
+
preview: z2.string().nullable(),
|
|
76
|
+
documentId: z2.string().nullable(),
|
|
77
|
+
metadata: z2.any(),
|
|
78
|
+
fileUrl: z2.string().nullable(),
|
|
79
|
+
filePath: z2.string().nullable(),
|
|
80
|
+
fileSize: z2.number().nullable(),
|
|
81
|
+
fileType: z2.string().nullable(),
|
|
82
|
+
checksum: z2.string().nullable(),
|
|
83
|
+
version: z2.number(),
|
|
84
|
+
createdAt: z2.date(),
|
|
85
|
+
updatedAt: z2.date(),
|
|
86
|
+
deletedAt: z2.date().nullable()
|
|
87
|
+
});
|
|
88
|
+
var EntitySchema = z2.discriminatedUnion("type", [
|
|
89
|
+
baseEntitySchema.extend({ type: z2.literal("task"), metadata: ENTITY_SCHEMAS.task }),
|
|
90
|
+
baseEntitySchema.extend({ type: z2.literal("note"), metadata: ENTITY_SCHEMAS.note }),
|
|
91
|
+
baseEntitySchema.extend({ type: z2.literal("person"), metadata: ENTITY_SCHEMAS.person }),
|
|
92
|
+
baseEntitySchema.extend({ type: z2.literal("event"), metadata: ENTITY_SCHEMAS.event }),
|
|
93
|
+
baseEntitySchema.extend({ type: z2.literal("file"), metadata: ENTITY_SCHEMAS.file }),
|
|
94
|
+
baseEntitySchema.extend({ type: z2.literal("code"), metadata: ENTITY_SCHEMAS.code }),
|
|
95
|
+
baseEntitySchema.extend({ type: z2.literal("bookmark"), metadata: ENTITY_SCHEMAS.bookmark }),
|
|
96
|
+
baseEntitySchema.extend({ type: z2.literal("company"), metadata: ENTITY_SCHEMAS.company })
|
|
97
|
+
]);
|
|
98
|
+
|
|
94
99
|
// src/entities/guards.ts
|
|
95
100
|
function isTask(entity) {
|
|
96
101
|
return entity.type === "task";
|
|
@@ -115,6 +120,7 @@ export {
|
|
|
115
120
|
ENTITY_SCHEMAS,
|
|
116
121
|
validateEntityMetadata,
|
|
117
122
|
safeValidateEntityMetadata,
|
|
123
|
+
EntitySchema,
|
|
118
124
|
isTask,
|
|
119
125
|
isNote,
|
|
120
126
|
isPerson,
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// src/documents/index.ts
|
|
2
|
+
import {
|
|
3
|
+
insertDocumentSchema,
|
|
4
|
+
selectDocumentSchema,
|
|
5
|
+
insertDocumentVersionSchema,
|
|
6
|
+
selectDocumentVersionSchema,
|
|
7
|
+
insertDocumentSessionSchema,
|
|
8
|
+
selectDocumentSessionSchema,
|
|
9
|
+
insertDocumentProposalSchema,
|
|
10
|
+
selectDocumentProposalSchema
|
|
11
|
+
} from "@synap/database/schema";
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
insertDocumentSchema,
|
|
15
|
+
selectDocumentSchema,
|
|
16
|
+
insertDocumentVersionSchema,
|
|
17
|
+
selectDocumentVersionSchema,
|
|
18
|
+
insertDocumentSessionSchema,
|
|
19
|
+
selectDocumentSessionSchema,
|
|
20
|
+
insertDocumentProposalSchema,
|
|
21
|
+
selectDocumentProposalSchema
|
|
22
|
+
};
|
|
@@ -1,64 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* Document Types
|
|
3
|
-
*
|
|
4
|
-
* Standalone type definitions for documents.
|
|
5
|
-
* Compatible with @synap/database schema but works independently.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* Document - Rich text document with version history
|
|
9
|
-
*/
|
|
10
|
-
interface Document {
|
|
11
|
-
id: string;
|
|
12
|
-
userId: string;
|
|
13
|
-
title: string | null;
|
|
14
|
-
type: 'note' | 'whiteboard' | 'canvas' | 'code' | 'other';
|
|
15
|
-
content?: string;
|
|
16
|
-
yjsState?: Uint8Array;
|
|
17
|
-
contentFormat: 'markdown' | 'prosemirror' | 'tiptap' | 'yjs' | 'raw';
|
|
18
|
-
version: number;
|
|
19
|
-
createdAt: Date;
|
|
20
|
-
updatedAt: Date;
|
|
21
|
-
deletedAt?: Date;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* NewDocument - For creating a new document
|
|
25
|
-
*/
|
|
26
|
-
type NewDocument = Omit<Document, 'id' | 'version' | 'createdAt' | 'updatedAt' | 'deletedAt'>;
|
|
27
|
-
/**
|
|
28
|
-
* UpdateDocument - For updating a document
|
|
29
|
-
*/
|
|
30
|
-
type UpdateDocument = Partial<Omit<Document, 'id' | 'userId' | 'createdAt' | 'updatedAt'>>;
|
|
31
|
-
/**
|
|
32
|
-
* DocumentVersion - Version history entry
|
|
33
|
-
*/
|
|
34
|
-
interface DocumentVersion {
|
|
35
|
-
id: string;
|
|
36
|
-
documentId: string;
|
|
37
|
-
userId: string;
|
|
38
|
-
version: number;
|
|
39
|
-
content?: string;
|
|
40
|
-
yjsState?: Uint8Array;
|
|
41
|
-
message?: string;
|
|
42
|
-
createdAt: Date;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* NewDocumentVersion - For creating a version
|
|
46
|
-
*/
|
|
47
|
-
type NewDocumentVersion = Omit<DocumentVersion, 'id' | 'createdAt'>;
|
|
48
|
-
/**
|
|
49
|
-
* DocumentSession - Collaboration session
|
|
50
|
-
*/
|
|
51
|
-
interface DocumentSession {
|
|
52
|
-
id: string;
|
|
53
|
-
documentId: string;
|
|
54
|
-
userId: string;
|
|
55
|
-
cursorPosition?: string;
|
|
56
|
-
lastActivity: Date;
|
|
57
|
-
createdAt: Date;
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* NewDocumentSession - For creating a session
|
|
61
|
-
*/
|
|
62
|
-
type NewDocumentSession = Omit<DocumentSession, 'id' | 'createdAt' | 'lastActivity'>;
|
|
63
|
-
|
|
64
|
-
export type { Document, DocumentSession, DocumentVersion, NewDocument, NewDocumentSession, NewDocumentVersion, UpdateDocument };
|
|
1
|
+
export { Document, DocumentProposal, DocumentSession, DocumentVersion, NewDocument, NewDocumentProposal, NewDocumentSession, NewDocumentVersion, insertDocumentProposalSchema, insertDocumentSchema, insertDocumentSessionSchema, insertDocumentVersionSchema, selectDocumentProposalSchema, selectDocumentSchema, selectDocumentSessionSchema, selectDocumentVersionSchema } from '@synap/database/schema';
|
package/dist/documents/index.js
CHANGED
|
@@ -1 +1,20 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
insertDocumentProposalSchema,
|
|
3
|
+
insertDocumentSchema,
|
|
4
|
+
insertDocumentSessionSchema,
|
|
5
|
+
insertDocumentVersionSchema,
|
|
6
|
+
selectDocumentProposalSchema,
|
|
7
|
+
selectDocumentSchema,
|
|
8
|
+
selectDocumentSessionSchema,
|
|
9
|
+
selectDocumentVersionSchema
|
|
10
|
+
} from "../chunk-WXJ4PQR7.js";
|
|
11
|
+
export {
|
|
12
|
+
insertDocumentProposalSchema,
|
|
13
|
+
insertDocumentSchema,
|
|
14
|
+
insertDocumentSessionSchema,
|
|
15
|
+
insertDocumentVersionSchema,
|
|
16
|
+
selectDocumentProposalSchema,
|
|
17
|
+
selectDocumentSchema,
|
|
18
|
+
selectDocumentSessionSchema,
|
|
19
|
+
selectDocumentVersionSchema
|
|
20
|
+
};
|