@synap-core/types 0.3.1 → 0.3.3
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/dist/chunk-QAWJ6GM3.js +0 -0
- package/dist/{chunk-OPLFDITK.js → chunk-RIUK6OEK.js} +40 -0
- package/dist/entities/index.d.ts +138 -0
- package/dist/entities/index.js +1 -1
- package/dist/index.d.ts +4 -3
- package/dist/index.js +13 -12
- package/dist/realtime/index.d.ts +21 -1
- package/dist/relations/index.d.ts +36 -0
- package/dist/relations/index.js +1 -0
- package/dist/views/index.d.ts +107 -3
- package/package.json +5 -1
- package/src/entities/schemas.ts +38 -0
- package/src/index.ts +5 -1
- package/src/realtime/index.ts +22 -0
- package/src/relations/index.ts +49 -0
- package/src/views/index.ts +148 -4
- package/tsup.config.ts +1 -0
|
File without changes
|
|
@@ -42,6 +42,46 @@ var ENTITY_SCHEMAS = {
|
|
|
42
42
|
extension: z.string(),
|
|
43
43
|
thumbnailUrl: z.string().url().optional(),
|
|
44
44
|
downloadUrl: z.string().url().optional()
|
|
45
|
+
}),
|
|
46
|
+
// NEW: Company/Organization entity
|
|
47
|
+
company: z.object({
|
|
48
|
+
website: z.string().url().optional(),
|
|
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([])
|
|
57
|
+
}),
|
|
58
|
+
// NEW: Bookmark/Web clip entity
|
|
59
|
+
bookmark: z.object({
|
|
60
|
+
url: z.string().url(),
|
|
61
|
+
favicon: z.string().url().optional(),
|
|
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)
|
|
70
|
+
}),
|
|
71
|
+
// NEW: Code snippet entity
|
|
72
|
+
code: z.object({
|
|
73
|
+
language: z.string(),
|
|
74
|
+
// 'typescript', 'python', 'rust', etc.
|
|
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
|
|
45
85
|
})
|
|
46
86
|
};
|
|
47
87
|
function validateEntityMetadata(type, metadata) {
|
package/dist/entities/index.d.ts
CHANGED
|
@@ -129,6 +129,90 @@ declare const ENTITY_SCHEMAS: {
|
|
|
129
129
|
thumbnailUrl?: string | undefined;
|
|
130
130
|
downloadUrl?: string | undefined;
|
|
131
131
|
}>;
|
|
132
|
+
readonly company: z.ZodObject<{
|
|
133
|
+
website: z.ZodOptional<z.ZodString>;
|
|
134
|
+
industry: z.ZodOptional<z.ZodString>;
|
|
135
|
+
size: z.ZodOptional<z.ZodEnum<["startup", "small", "medium", "large", "enterprise"]>>;
|
|
136
|
+
location: z.ZodOptional<z.ZodString>;
|
|
137
|
+
linkedInUrl: z.ZodOptional<z.ZodString>;
|
|
138
|
+
description: z.ZodOptional<z.ZodString>;
|
|
139
|
+
foundedYear: z.ZodOptional<z.ZodNumber>;
|
|
140
|
+
employees: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
141
|
+
}, "strip", z.ZodTypeAny, {
|
|
142
|
+
employees: string[];
|
|
143
|
+
linkedInUrl?: string | undefined;
|
|
144
|
+
location?: string | undefined;
|
|
145
|
+
website?: string | undefined;
|
|
146
|
+
industry?: string | undefined;
|
|
147
|
+
size?: "medium" | "startup" | "small" | "large" | "enterprise" | undefined;
|
|
148
|
+
description?: string | undefined;
|
|
149
|
+
foundedYear?: number | undefined;
|
|
150
|
+
}, {
|
|
151
|
+
linkedInUrl?: string | undefined;
|
|
152
|
+
location?: string | undefined;
|
|
153
|
+
website?: string | undefined;
|
|
154
|
+
industry?: string | undefined;
|
|
155
|
+
size?: "medium" | "startup" | "small" | "large" | "enterprise" | undefined;
|
|
156
|
+
description?: string | undefined;
|
|
157
|
+
foundedYear?: number | undefined;
|
|
158
|
+
employees?: string[] | undefined;
|
|
159
|
+
}>;
|
|
160
|
+
readonly bookmark: z.ZodObject<{
|
|
161
|
+
url: z.ZodString;
|
|
162
|
+
favicon: z.ZodOptional<z.ZodString>;
|
|
163
|
+
excerpt: z.ZodOptional<z.ZodString>;
|
|
164
|
+
siteName: z.ZodOptional<z.ZodString>;
|
|
165
|
+
author: z.ZodOptional<z.ZodString>;
|
|
166
|
+
publishedDate: z.ZodOptional<z.ZodString>;
|
|
167
|
+
tags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
168
|
+
archiveUrl: z.ZodOptional<z.ZodString>;
|
|
169
|
+
isRead: z.ZodDefault<z.ZodBoolean>;
|
|
170
|
+
}, "strip", z.ZodTypeAny, {
|
|
171
|
+
tags: string[];
|
|
172
|
+
url: string;
|
|
173
|
+
isRead: boolean;
|
|
174
|
+
favicon?: string | undefined;
|
|
175
|
+
excerpt?: string | undefined;
|
|
176
|
+
siteName?: string | undefined;
|
|
177
|
+
author?: string | undefined;
|
|
178
|
+
publishedDate?: string | undefined;
|
|
179
|
+
archiveUrl?: string | undefined;
|
|
180
|
+
}, {
|
|
181
|
+
url: string;
|
|
182
|
+
tags?: string[] | undefined;
|
|
183
|
+
favicon?: string | undefined;
|
|
184
|
+
excerpt?: string | undefined;
|
|
185
|
+
siteName?: string | undefined;
|
|
186
|
+
author?: string | undefined;
|
|
187
|
+
publishedDate?: string | undefined;
|
|
188
|
+
archiveUrl?: string | undefined;
|
|
189
|
+
isRead?: boolean | undefined;
|
|
190
|
+
}>;
|
|
191
|
+
readonly code: z.ZodObject<{
|
|
192
|
+
language: z.ZodString;
|
|
193
|
+
runtime: z.ZodOptional<z.ZodString>;
|
|
194
|
+
framework: z.ZodOptional<z.ZodString>;
|
|
195
|
+
dependencies: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
196
|
+
isExecutable: z.ZodDefault<z.ZodBoolean>;
|
|
197
|
+
sourceUrl: z.ZodOptional<z.ZodString>;
|
|
198
|
+
version: z.ZodOptional<z.ZodString>;
|
|
199
|
+
}, "strip", z.ZodTypeAny, {
|
|
200
|
+
language: string;
|
|
201
|
+
dependencies: string[];
|
|
202
|
+
isExecutable: boolean;
|
|
203
|
+
runtime?: string | undefined;
|
|
204
|
+
framework?: string | undefined;
|
|
205
|
+
sourceUrl?: string | undefined;
|
|
206
|
+
version?: string | undefined;
|
|
207
|
+
}, {
|
|
208
|
+
language: string;
|
|
209
|
+
runtime?: string | undefined;
|
|
210
|
+
framework?: string | undefined;
|
|
211
|
+
dependencies?: string[] | undefined;
|
|
212
|
+
isExecutable?: boolean | undefined;
|
|
213
|
+
sourceUrl?: string | undefined;
|
|
214
|
+
version?: string | undefined;
|
|
215
|
+
}>;
|
|
132
216
|
};
|
|
133
217
|
/**
|
|
134
218
|
* Entity type enum - auto-generated from schema keys
|
|
@@ -220,6 +304,60 @@ declare function safeValidateEntityMetadata<T extends EntityType>(type: T, metad
|
|
|
220
304
|
extension: string;
|
|
221
305
|
thumbnailUrl?: string | undefined;
|
|
222
306
|
downloadUrl?: string | undefined;
|
|
307
|
+
}> | z.SafeParseReturnType<{
|
|
308
|
+
linkedInUrl?: string | undefined;
|
|
309
|
+
location?: string | undefined;
|
|
310
|
+
website?: string | undefined;
|
|
311
|
+
industry?: string | undefined;
|
|
312
|
+
size?: "medium" | "startup" | "small" | "large" | "enterprise" | undefined;
|
|
313
|
+
description?: string | undefined;
|
|
314
|
+
foundedYear?: number | undefined;
|
|
315
|
+
employees?: string[] | undefined;
|
|
316
|
+
}, {
|
|
317
|
+
employees: string[];
|
|
318
|
+
linkedInUrl?: string | undefined;
|
|
319
|
+
location?: string | undefined;
|
|
320
|
+
website?: string | undefined;
|
|
321
|
+
industry?: string | undefined;
|
|
322
|
+
size?: "medium" | "startup" | "small" | "large" | "enterprise" | undefined;
|
|
323
|
+
description?: string | undefined;
|
|
324
|
+
foundedYear?: number | undefined;
|
|
325
|
+
}> | z.SafeParseReturnType<{
|
|
326
|
+
url: string;
|
|
327
|
+
tags?: string[] | undefined;
|
|
328
|
+
favicon?: string | undefined;
|
|
329
|
+
excerpt?: string | undefined;
|
|
330
|
+
siteName?: string | undefined;
|
|
331
|
+
author?: string | undefined;
|
|
332
|
+
publishedDate?: string | undefined;
|
|
333
|
+
archiveUrl?: string | undefined;
|
|
334
|
+
isRead?: boolean | undefined;
|
|
335
|
+
}, {
|
|
336
|
+
tags: string[];
|
|
337
|
+
url: string;
|
|
338
|
+
isRead: boolean;
|
|
339
|
+
favicon?: string | undefined;
|
|
340
|
+
excerpt?: string | undefined;
|
|
341
|
+
siteName?: string | undefined;
|
|
342
|
+
author?: string | undefined;
|
|
343
|
+
publishedDate?: string | undefined;
|
|
344
|
+
archiveUrl?: string | undefined;
|
|
345
|
+
}> | z.SafeParseReturnType<{
|
|
346
|
+
language: string;
|
|
347
|
+
runtime?: string | undefined;
|
|
348
|
+
framework?: string | undefined;
|
|
349
|
+
dependencies?: string[] | undefined;
|
|
350
|
+
isExecutable?: boolean | undefined;
|
|
351
|
+
sourceUrl?: string | undefined;
|
|
352
|
+
version?: string | undefined;
|
|
353
|
+
}, {
|
|
354
|
+
language: string;
|
|
355
|
+
dependencies: string[];
|
|
356
|
+
isExecutable: boolean;
|
|
357
|
+
runtime?: string | undefined;
|
|
358
|
+
framework?: string | undefined;
|
|
359
|
+
sourceUrl?: string | undefined;
|
|
360
|
+
version?: string | undefined;
|
|
223
361
|
}>;
|
|
224
362
|
|
|
225
363
|
/**
|
package/dist/entities/index.js
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
export { BaseEntity, ENTITY_SCHEMAS, Entity, EntityMetadata, EntityType, Event, File, NewEntity, Note, Person, Task, UpdateEntity, isEntityOfType, isEvent, isFile, isNote, isPerson, isTask, safeValidateEntityMetadata, validateEntityMetadata } from './entities/index.js';
|
|
2
2
|
export { UpdateDocument } from './documents/index.js';
|
|
3
|
-
export { Entity as DBEntity, InboxItem as DBInboxItem, Document, DocumentSession, DocumentVersion, EntityEnrichment, EntityRelationship, NewDocument, NewDocumentSession, NewDocumentVersion, NewEntity as NewEntityDB, NewEntityEnrichment, NewEntityRelationship, NewInboxItem, NewReasoningTrace, NewUserEntityState, NewUserPreference as NewUserPreferences, NewView, NewWorkspace, NewWorkspaceInvite, NewWorkspaceMember, ReasoningTrace, UserEntityState, UserPreference as UserPreferences, View, Workspace, WorkspaceInvite, WorkspaceMember } from '@synap/database/schema';
|
|
3
|
+
export { Entity as DBEntity, InboxItem as DBInboxItem, Document, DocumentSession, DocumentVersion, EntityEnrichment, EntityRelationship, NewDocument, NewDocumentSession, NewDocumentVersion, NewEntity as NewEntityDB, NewEntityEnrichment, NewEntityRelationship, NewInboxItem, NewReasoningTrace, NewRelation, NewUserEntityState, NewUserPreference as NewUserPreferences, NewView, NewWorkspace, NewWorkspaceInvite, NewWorkspaceMember, ReasoningTrace, Relation, UserEntityState, UserPreference as UserPreferences, View, Workspace, WorkspaceInvite, WorkspaceMember } from '@synap/database/schema';
|
|
4
4
|
export { CalendarInboxItem, EmailInboxItem, INBOX_SCHEMAS, InboxItem, InboxItemType, SlackInboxItem, isCalendarInboxItem, isEmailInboxItem, isSlackInboxItem } from './inbox/index.js';
|
|
5
5
|
export { CreateWorkspaceInput, InviteMemberInput, UpdateWorkspaceInput, WorkspaceRole, WorkspaceType } from './workspaces/index.js';
|
|
6
|
-
export { CreateViewInput, SaveViewInput, UpdateViewInput, ViewType } from './views/index.js';
|
|
6
|
+
export { CalendarConfig, ColumnDefinition, CreateViewInput, FilterRule, GanttConfig, GridConfig, KanbanConfig, ListConfig, SaveViewInput, SortRule, SwitchViewLayoutInput, TableViewConfig, UpdateViewInput, ViewType } from './views/index.js';
|
|
7
|
+
export { CreateRelationInput, RelationType, RelationWithEntities } from './relations/index.js';
|
|
7
8
|
export { Theme, UpdatePreferencesInput } from './preferences/index.js';
|
|
8
|
-
export { CollaborationEvent, CursorUpdate, PresenceInit, PresenceStatus, UserPresence } from './realtime/index.js';
|
|
9
|
+
export { CollaborationEvent, CursorUpdate, PresenceInit, PresenceStatus, UserJoinedEvent, UserLeftEvent, UserPresence } from './realtime/index.js';
|
|
9
10
|
export { AIProposalEvent, AIProposalStatusEvent, ChatMessageEvent, ChatStreamEvent, DocumentUpdatedEvent, DocumentVersionCreatedEvent, DomainClientToServerEvents, DomainEventName, DomainEventNames, DomainServerToClientEvents, EntityCreatedEvent, EntityDeletedEvent, EntityUpdatedEvent } from './events/index.js';
|
|
10
11
|
export { Array as YArray, Doc as YDoc, Map as YMap, Text as YText } from 'yjs';
|
|
11
12
|
import 'zod';
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
INBOX_SCHEMAS,
|
|
3
|
+
isCalendarInboxItem,
|
|
4
|
+
isEmailInboxItem,
|
|
5
|
+
isSlackInboxItem
|
|
6
|
+
} from "./chunk-ZFFMXKF2.js";
|
|
7
|
+
import "./chunk-2BEUWD3P.js";
|
|
2
8
|
import "./chunk-IZA3UKBT.js";
|
|
3
9
|
import "./chunk-7LKCNZXD.js";
|
|
4
|
-
import {
|
|
5
|
-
DomainEventNames
|
|
6
|
-
} from "./chunk-6OHYLFUB.js";
|
|
7
10
|
import {
|
|
8
11
|
ENTITY_SCHEMAS,
|
|
9
12
|
isEntityOfType,
|
|
@@ -14,16 +17,14 @@ import {
|
|
|
14
17
|
isTask,
|
|
15
18
|
safeValidateEntityMetadata,
|
|
16
19
|
validateEntityMetadata
|
|
17
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-RIUK6OEK.js";
|
|
18
21
|
import {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
isSlackInboxItem
|
|
23
|
-
} from "./chunk-ZFFMXKF2.js";
|
|
24
|
-
import "./chunk-2BEUWD3P.js";
|
|
25
|
-
import "./chunk-X5L3VJJZ.js";
|
|
22
|
+
DomainEventNames
|
|
23
|
+
} from "./chunk-6OHYLFUB.js";
|
|
24
|
+
import "./chunk-QAWJ6GM3.js";
|
|
26
25
|
import "./chunk-2N5ZC5EB.js";
|
|
26
|
+
import "./chunk-X5L3VJJZ.js";
|
|
27
|
+
import "./chunk-ZTGPGYVX.js";
|
|
27
28
|
export {
|
|
28
29
|
DomainEventNames,
|
|
29
30
|
ENTITY_SCHEMAS,
|
package/dist/realtime/index.d.ts
CHANGED
|
@@ -53,5 +53,25 @@ interface CursorUpdate {
|
|
|
53
53
|
y: number;
|
|
54
54
|
viewId: string;
|
|
55
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* User joined event (emitted when user joins a workspace/document)
|
|
58
|
+
*/
|
|
59
|
+
interface UserJoinedEvent {
|
|
60
|
+
userId: string;
|
|
61
|
+
userName: string;
|
|
62
|
+
workspaceId: string;
|
|
63
|
+
documentId?: string;
|
|
64
|
+
color?: string;
|
|
65
|
+
timestamp: number;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* User left event (emitted when user leaves a workspace/document)
|
|
69
|
+
*/
|
|
70
|
+
interface UserLeftEvent {
|
|
71
|
+
userId: string;
|
|
72
|
+
workspaceId: string;
|
|
73
|
+
documentId?: string;
|
|
74
|
+
timestamp: number;
|
|
75
|
+
}
|
|
56
76
|
|
|
57
|
-
export type { CollaborationEvent, CursorUpdate, PresenceInit, PresenceStatus, UserPresence };
|
|
77
|
+
export type { CollaborationEvent, CursorUpdate, PresenceInit, PresenceStatus, UserJoinedEvent, UserLeftEvent, UserPresence };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export { NewRelation, Relation } from '@synap/database/schema';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Relation Types
|
|
5
|
+
*
|
|
6
|
+
* Re-exports relation types from database schema (single source of truth).
|
|
7
|
+
*
|
|
8
|
+
* @see {@link file:///.../packages/database/src/schema/relations.ts}
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
type RelationType = 'related_to' | 'parent_of' | 'child_of' | 'blocks' | 'mentioned_in' | 'linked_to';
|
|
12
|
+
interface CreateRelationInput {
|
|
13
|
+
sourceEntityId: string;
|
|
14
|
+
targetEntityId: string;
|
|
15
|
+
type: RelationType;
|
|
16
|
+
metadata?: Record<string, unknown>;
|
|
17
|
+
}
|
|
18
|
+
interface RelationWithEntities {
|
|
19
|
+
id: string;
|
|
20
|
+
sourceEntityId: string;
|
|
21
|
+
targetEntityId: string;
|
|
22
|
+
type: RelationType;
|
|
23
|
+
createdAt: Date;
|
|
24
|
+
sourceEntity?: {
|
|
25
|
+
id: string;
|
|
26
|
+
title: string | null;
|
|
27
|
+
type: string;
|
|
28
|
+
};
|
|
29
|
+
targetEntity?: {
|
|
30
|
+
id: string;
|
|
31
|
+
title: string | null;
|
|
32
|
+
type: string;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type { CreateRelationInput, RelationType, RelationWithEntities };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "../chunk-QAWJ6GM3.js";
|
package/dist/views/index.d.ts
CHANGED
|
@@ -1,31 +1,135 @@
|
|
|
1
|
-
import { View } from '@synap/database/schema';
|
|
2
1
|
export { NewView, View } from '@synap/database/schema';
|
|
3
2
|
|
|
4
3
|
/**
|
|
5
4
|
* View Types
|
|
6
5
|
*
|
|
7
6
|
* Re-exports view types from database schema (single source of truth).
|
|
7
|
+
* Extended with Table Inversion System configuration types.
|
|
8
8
|
*
|
|
9
9
|
* @see {@link file:///.../packages/database/src/schema/views.ts}
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* View types - categorized by rendering approach
|
|
14
|
+
*
|
|
15
|
+
* Canvas-based: Freeform positioning (e.g., whiteboard)
|
|
16
|
+
* Table-based: Data-driven with layout variations (Table Inversion System)
|
|
17
|
+
* Specialized: Unique rendering logic
|
|
18
|
+
*/
|
|
19
|
+
type ViewType = 'whiteboard' | 'table' | 'kanban' | 'list' | 'grid' | 'gallery' | 'calendar' | 'gantt' | 'timeline' | 'mindmap' | 'graph';
|
|
20
|
+
/**
|
|
21
|
+
* Column definition for table-based views
|
|
22
|
+
*/
|
|
23
|
+
interface ColumnDefinition {
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
type: 'text' | 'number' | 'date' | 'select' | 'multi-select' | 'checkbox' | 'url' | 'email' | 'phone' | 'person' | 'relation' | 'formula' | 'rollup';
|
|
27
|
+
options?: string[];
|
|
28
|
+
relationTableId?: string;
|
|
29
|
+
formula?: string;
|
|
30
|
+
width?: number;
|
|
31
|
+
isHidden?: boolean;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Filter rule for views
|
|
35
|
+
*/
|
|
36
|
+
interface FilterRule {
|
|
37
|
+
columnId: string;
|
|
38
|
+
operator: 'equals' | 'not_equals' | 'contains' | 'not_contains' | 'is_empty' | 'is_not_empty' | 'greater_than' | 'less_than' | 'date_is' | 'date_before' | 'date_after';
|
|
39
|
+
value?: unknown;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Sort rule for views
|
|
43
|
+
*/
|
|
44
|
+
interface SortRule {
|
|
45
|
+
columnId: string;
|
|
46
|
+
direction: 'asc' | 'desc';
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Kanban-specific configuration
|
|
50
|
+
*/
|
|
51
|
+
interface KanbanConfig {
|
|
52
|
+
groupByColumnId: string;
|
|
53
|
+
swimlaneColumnId?: string;
|
|
54
|
+
cardDisplayColumns: string[];
|
|
55
|
+
hideEmptyGroups?: boolean;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Calendar-specific configuration
|
|
59
|
+
*/
|
|
60
|
+
interface CalendarConfig {
|
|
61
|
+
dateColumnId: string;
|
|
62
|
+
endDateColumnId?: string;
|
|
63
|
+
titleColumnId: string;
|
|
64
|
+
showWeekends?: boolean;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Grid/Gallery-specific configuration
|
|
68
|
+
*/
|
|
69
|
+
interface GridConfig {
|
|
70
|
+
itemsPerRow: number;
|
|
71
|
+
cardSize: 'compact' | 'normal' | 'large';
|
|
72
|
+
thumbnailColumnId?: string;
|
|
73
|
+
showTitle?: boolean;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* List-specific configuration
|
|
77
|
+
*/
|
|
78
|
+
interface ListConfig {
|
|
79
|
+
primaryColumnId: string;
|
|
80
|
+
secondaryColumnIds?: string[];
|
|
81
|
+
showCheckboxes?: boolean;
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Gantt/Timeline-specific configuration
|
|
85
|
+
*/
|
|
86
|
+
interface GanttConfig {
|
|
87
|
+
startDateColumnId: string;
|
|
88
|
+
endDateColumnId: string;
|
|
89
|
+
dependencyColumnId?: string;
|
|
90
|
+
progressColumnId?: string;
|
|
91
|
+
milestoneColumnId?: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Table View Configuration (Table Inversion System)
|
|
95
|
+
*
|
|
96
|
+
* Stores the configuration for any table-based view.
|
|
97
|
+
* The same data can be displayed in different layouts by changing the `layout` property.
|
|
98
|
+
*/
|
|
99
|
+
interface TableViewConfig {
|
|
100
|
+
layout: 'table' | 'kanban' | 'list' | 'grid' | 'gallery' | 'calendar' | 'gantt' | 'timeline';
|
|
101
|
+
columns: ColumnDefinition[];
|
|
102
|
+
filters?: FilterRule[];
|
|
103
|
+
sorts?: SortRule[];
|
|
104
|
+
groupByColumnId?: string;
|
|
105
|
+
kanbanConfig?: KanbanConfig;
|
|
106
|
+
calendarConfig?: CalendarConfig;
|
|
107
|
+
gridConfig?: GridConfig;
|
|
108
|
+
listConfig?: ListConfig;
|
|
109
|
+
ganttConfig?: GanttConfig;
|
|
110
|
+
}
|
|
13
111
|
interface CreateViewInput {
|
|
14
112
|
workspaceId?: string;
|
|
15
113
|
type: ViewType;
|
|
16
114
|
name: string;
|
|
17
115
|
description?: string;
|
|
18
116
|
initialContent?: unknown;
|
|
117
|
+
tableConfig?: TableViewConfig;
|
|
19
118
|
}
|
|
20
119
|
interface UpdateViewInput {
|
|
21
120
|
name?: string;
|
|
22
121
|
description?: string;
|
|
23
122
|
metadata?: Record<string, unknown>;
|
|
123
|
+
tableConfig?: Partial<TableViewConfig>;
|
|
24
124
|
}
|
|
25
125
|
interface SaveViewInput {
|
|
26
126
|
viewId: string;
|
|
27
127
|
content: unknown;
|
|
28
128
|
saveType?: 'auto' | 'manual' | 'publish';
|
|
29
129
|
}
|
|
130
|
+
interface SwitchViewLayoutInput {
|
|
131
|
+
viewId: string;
|
|
132
|
+
newLayout: TableViewConfig['layout'];
|
|
133
|
+
}
|
|
30
134
|
|
|
31
|
-
export type { CreateViewInput, SaveViewInput, UpdateViewInput, ViewType };
|
|
135
|
+
export type { CalendarConfig, ColumnDefinition, CreateViewInput, FilterRule, GanttConfig, GridConfig, KanbanConfig, ListConfig, SaveViewInput, SortRule, SwitchViewLayoutInput, TableViewConfig, UpdateViewInput, ViewType };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synap-core/types",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -36,6 +36,10 @@
|
|
|
36
36
|
"types": "./dist/views/index.d.ts",
|
|
37
37
|
"import": "./dist/views/index.js"
|
|
38
38
|
},
|
|
39
|
+
"./relations": {
|
|
40
|
+
"types": "./dist/relations/index.d.ts",
|
|
41
|
+
"import": "./dist/relations/index.js"
|
|
42
|
+
},
|
|
39
43
|
"./preferences": {
|
|
40
44
|
"types": "./dist/preferences/index.d.ts",
|
|
41
45
|
"import": "./dist/preferences/index.js"
|
package/src/entities/schemas.ts
CHANGED
|
@@ -60,6 +60,44 @@ export const ENTITY_SCHEMAS = {
|
|
|
60
60
|
thumbnailUrl: z.string().url().optional(),
|
|
61
61
|
downloadUrl: z.string().url().optional(),
|
|
62
62
|
}),
|
|
63
|
+
|
|
64
|
+
// NEW: Company/Organization entity
|
|
65
|
+
company: z.object({
|
|
66
|
+
website: z.string().url().optional(),
|
|
67
|
+
industry: z.string().optional(),
|
|
68
|
+
size: z.enum(['startup', 'small', 'medium', 'large', 'enterprise']).optional(),
|
|
69
|
+
location: z.string().optional(),
|
|
70
|
+
linkedInUrl: z.string().url().optional(),
|
|
71
|
+
description: z.string().optional(),
|
|
72
|
+
foundedYear: z.number().int().optional(),
|
|
73
|
+
// Linked employee person entities
|
|
74
|
+
employees: z.array(z.string().uuid()).default([]),
|
|
75
|
+
}),
|
|
76
|
+
|
|
77
|
+
// NEW: Bookmark/Web clip entity
|
|
78
|
+
bookmark: z.object({
|
|
79
|
+
url: z.string().url(),
|
|
80
|
+
favicon: z.string().url().optional(),
|
|
81
|
+
excerpt: z.string().optional(),
|
|
82
|
+
siteName: z.string().optional(),
|
|
83
|
+
author: z.string().optional(),
|
|
84
|
+
publishedDate: z.string().datetime().optional(),
|
|
85
|
+
tags: z.array(z.string()).default([]),
|
|
86
|
+
// For local archiving
|
|
87
|
+
archiveUrl: z.string().url().optional(),
|
|
88
|
+
isRead: z.boolean().default(false),
|
|
89
|
+
}),
|
|
90
|
+
|
|
91
|
+
// NEW: Code snippet entity
|
|
92
|
+
code: z.object({
|
|
93
|
+
language: z.string(), // 'typescript', 'python', 'rust', etc.
|
|
94
|
+
runtime: z.string().optional(), // 'node', 'browser', 'python3', etc.
|
|
95
|
+
framework: z.string().optional(), // 'react', 'express', 'django', etc.
|
|
96
|
+
dependencies: z.array(z.string()).default([]),
|
|
97
|
+
isExecutable: z.boolean().default(false),
|
|
98
|
+
sourceUrl: z.string().url().optional(), // GitHub gist, CodeSandbox, etc.
|
|
99
|
+
version: z.string().optional(), // Code version/revision
|
|
100
|
+
}),
|
|
63
101
|
} as const;
|
|
64
102
|
|
|
65
103
|
/**
|
package/src/index.ts
CHANGED
|
@@ -22,9 +22,12 @@ export * from './inbox/index.js';
|
|
|
22
22
|
// Workspace types (V3.0)
|
|
23
23
|
export * from './workspaces/index.js';
|
|
24
24
|
|
|
25
|
-
// View types (V3.0)
|
|
25
|
+
// View types (V3.0) - Extended with Table Inversion System
|
|
26
26
|
export * from './views/index.js';
|
|
27
27
|
|
|
28
|
+
// Relation types (V3.1) - Knowledge graph edges
|
|
29
|
+
export * from './relations/index.js';
|
|
30
|
+
|
|
28
31
|
// Preferences types (V3.0)
|
|
29
32
|
export * from './preferences/index.js';
|
|
30
33
|
|
|
@@ -33,3 +36,4 @@ export * from './realtime/index.js';
|
|
|
33
36
|
|
|
34
37
|
// Domain event types for Socket.IO (V3.0)
|
|
35
38
|
export * from './events/index.js';
|
|
39
|
+
|
package/src/realtime/index.ts
CHANGED
|
@@ -58,3 +58,25 @@ export interface CursorUpdate {
|
|
|
58
58
|
y: number;
|
|
59
59
|
viewId: string;
|
|
60
60
|
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* User joined event (emitted when user joins a workspace/document)
|
|
64
|
+
*/
|
|
65
|
+
export interface UserJoinedEvent {
|
|
66
|
+
userId: string;
|
|
67
|
+
userName: string;
|
|
68
|
+
workspaceId: string;
|
|
69
|
+
documentId?: string;
|
|
70
|
+
color?: string;
|
|
71
|
+
timestamp: number;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* User left event (emitted when user leaves a workspace/document)
|
|
76
|
+
*/
|
|
77
|
+
export interface UserLeftEvent {
|
|
78
|
+
userId: string;
|
|
79
|
+
workspaceId: string;
|
|
80
|
+
documentId?: string;
|
|
81
|
+
timestamp: number;
|
|
82
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Relation Types
|
|
3
|
+
*
|
|
4
|
+
* Re-exports relation types from database schema (single source of truth).
|
|
5
|
+
*
|
|
6
|
+
* @see {@link file:///.../packages/database/src/schema/relations.ts}
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
// Direct re-exports from database
|
|
10
|
+
export type {
|
|
11
|
+
Relation,
|
|
12
|
+
NewRelation,
|
|
13
|
+
} from '@synap/database/schema';
|
|
14
|
+
|
|
15
|
+
// Relation type definitions
|
|
16
|
+
export type RelationType =
|
|
17
|
+
| 'related_to' // Generic relationship
|
|
18
|
+
| 'parent_of' // Hierarchy (parent → child)
|
|
19
|
+
| 'child_of' // Inverse hierarchy (child → parent)
|
|
20
|
+
| 'blocks' // Dependencies (X blocks Y)
|
|
21
|
+
| 'mentioned_in' // Content references
|
|
22
|
+
| 'linked_to'; // User-created links
|
|
23
|
+
|
|
24
|
+
// Input types for API operations
|
|
25
|
+
export interface CreateRelationInput {
|
|
26
|
+
sourceEntityId: string;
|
|
27
|
+
targetEntityId: string;
|
|
28
|
+
type: RelationType;
|
|
29
|
+
metadata?: Record<string, unknown>;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface RelationWithEntities {
|
|
33
|
+
id: string;
|
|
34
|
+
sourceEntityId: string;
|
|
35
|
+
targetEntityId: string;
|
|
36
|
+
type: RelationType;
|
|
37
|
+
createdAt: Date;
|
|
38
|
+
// Populated fields
|
|
39
|
+
sourceEntity?: {
|
|
40
|
+
id: string;
|
|
41
|
+
title: string | null;
|
|
42
|
+
type: string;
|
|
43
|
+
};
|
|
44
|
+
targetEntity?: {
|
|
45
|
+
id: string;
|
|
46
|
+
title: string | null;
|
|
47
|
+
type: string;
|
|
48
|
+
};
|
|
49
|
+
}
|
package/src/views/index.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* View Types
|
|
3
3
|
*
|
|
4
4
|
* Re-exports view types from database schema (single source of truth).
|
|
5
|
+
* Extended with Table Inversion System configuration types.
|
|
5
6
|
*
|
|
6
7
|
* @see {@link file:///.../packages/database/src/schema/views.ts}
|
|
7
8
|
*/
|
|
@@ -12,24 +13,162 @@ export type {
|
|
|
12
13
|
NewView,
|
|
13
14
|
} from '@synap/database/schema';
|
|
14
15
|
|
|
15
|
-
//
|
|
16
|
-
|
|
16
|
+
// =============================================================================
|
|
17
|
+
// View Type Enum
|
|
18
|
+
// =============================================================================
|
|
17
19
|
|
|
18
|
-
|
|
20
|
+
/**
|
|
21
|
+
* View types - categorized by rendering approach
|
|
22
|
+
*
|
|
23
|
+
* Canvas-based: Freeform positioning (e.g., whiteboard)
|
|
24
|
+
* Table-based: Data-driven with layout variations (Table Inversion System)
|
|
25
|
+
* Specialized: Unique rendering logic
|
|
26
|
+
*/
|
|
27
|
+
export type ViewType =
|
|
28
|
+
// Canvas-based (freeform)
|
|
29
|
+
| 'whiteboard' // Freeform canvas (Tldraw) - merges former 'board'
|
|
30
|
+
|
|
31
|
+
// Table-based (single data, different layouts - Table Inversion System)
|
|
32
|
+
| 'table' // Spreadsheet view (base layout)
|
|
33
|
+
| 'kanban' // Grouped columns (inverted table)
|
|
34
|
+
| 'list' // Simple list (inverted table)
|
|
35
|
+
| 'grid' // Card grid (inverted table)
|
|
36
|
+
| 'gallery' // Image-focused grid (inverted table)
|
|
37
|
+
| 'calendar' // Date-based placement (inverted table)
|
|
38
|
+
| 'gantt' // Timeline with dependencies (inverted table)
|
|
39
|
+
| 'timeline' // Chronological view (inverted table)
|
|
40
|
+
|
|
41
|
+
// Specialized
|
|
42
|
+
| 'mindmap' // Hierarchical tree visualization
|
|
43
|
+
| 'graph'; // Knowledge graph visualization
|
|
44
|
+
|
|
45
|
+
// =============================================================================
|
|
46
|
+
// Table Inversion System Configuration
|
|
47
|
+
// =============================================================================
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Column definition for table-based views
|
|
51
|
+
*/
|
|
52
|
+
export interface ColumnDefinition {
|
|
53
|
+
id: string;
|
|
54
|
+
name: string;
|
|
55
|
+
type: 'text' | 'number' | 'date' | 'select' | 'multi-select' | 'checkbox' | 'url' | 'email' | 'phone' | 'person' | 'relation' | 'formula' | 'rollup';
|
|
56
|
+
options?: string[]; // For select/multi-select
|
|
57
|
+
relationTableId?: string; // For relation columns
|
|
58
|
+
formula?: string; // For formula columns
|
|
59
|
+
width?: number; // Column width in pixels
|
|
60
|
+
isHidden?: boolean; // Hidden from current view
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Filter rule for views
|
|
65
|
+
*/
|
|
66
|
+
export interface FilterRule {
|
|
67
|
+
columnId: string;
|
|
68
|
+
operator: 'equals' | 'not_equals' | 'contains' | 'not_contains' | 'is_empty' | 'is_not_empty' | 'greater_than' | 'less_than' | 'date_is' | 'date_before' | 'date_after';
|
|
69
|
+
value?: unknown;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Sort rule for views
|
|
74
|
+
*/
|
|
75
|
+
export interface SortRule {
|
|
76
|
+
columnId: string;
|
|
77
|
+
direction: 'asc' | 'desc';
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Kanban-specific configuration
|
|
82
|
+
*/
|
|
83
|
+
export interface KanbanConfig {
|
|
84
|
+
groupByColumnId: string; // Column to group cards by (must be select type)
|
|
85
|
+
swimlaneColumnId?: string; // Optional horizontal grouping
|
|
86
|
+
cardDisplayColumns: string[]; // Which columns to show on cards
|
|
87
|
+
hideEmptyGroups?: boolean; // Hide columns with no cards
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Calendar-specific configuration
|
|
92
|
+
*/
|
|
93
|
+
export interface CalendarConfig {
|
|
94
|
+
dateColumnId: string; // Column for date placement
|
|
95
|
+
endDateColumnId?: string; // For multi-day events
|
|
96
|
+
titleColumnId: string; // Column for event title
|
|
97
|
+
showWeekends?: boolean; // Show weekend days
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Grid/Gallery-specific configuration
|
|
102
|
+
*/
|
|
103
|
+
export interface GridConfig {
|
|
104
|
+
itemsPerRow: number; // Cards per row
|
|
105
|
+
cardSize: 'compact' | 'normal' | 'large';
|
|
106
|
+
thumbnailColumnId?: string; // Column for preview image
|
|
107
|
+
showTitle?: boolean;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* List-specific configuration
|
|
112
|
+
*/
|
|
113
|
+
export interface ListConfig {
|
|
114
|
+
primaryColumnId: string; // Main display column
|
|
115
|
+
secondaryColumnIds?: string[]; // Additional columns to show
|
|
116
|
+
showCheckboxes?: boolean; // Show selection checkboxes
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Gantt/Timeline-specific configuration
|
|
121
|
+
*/
|
|
122
|
+
export interface GanttConfig {
|
|
123
|
+
startDateColumnId: string;
|
|
124
|
+
endDateColumnId: string;
|
|
125
|
+
dependencyColumnId?: string; // Relation column for dependencies
|
|
126
|
+
progressColumnId?: string; // Number column for % complete
|
|
127
|
+
milestoneColumnId?: string; // Checkbox column for milestones
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Table View Configuration (Table Inversion System)
|
|
132
|
+
*
|
|
133
|
+
* Stores the configuration for any table-based view.
|
|
134
|
+
* The same data can be displayed in different layouts by changing the `layout` property.
|
|
135
|
+
*/
|
|
136
|
+
export interface TableViewConfig {
|
|
137
|
+
// Current layout mode
|
|
138
|
+
layout: 'table' | 'kanban' | 'list' | 'grid' | 'gallery' | 'calendar' | 'gantt' | 'timeline';
|
|
139
|
+
|
|
140
|
+
// Universal settings (apply to all layouts)
|
|
141
|
+
columns: ColumnDefinition[];
|
|
142
|
+
filters?: FilterRule[];
|
|
143
|
+
sorts?: SortRule[];
|
|
144
|
+
groupByColumnId?: string; // Universal grouping (layout determines rendering)
|
|
145
|
+
|
|
146
|
+
// Layout-specific configurations
|
|
147
|
+
kanbanConfig?: KanbanConfig;
|
|
148
|
+
calendarConfig?: CalendarConfig;
|
|
149
|
+
gridConfig?: GridConfig;
|
|
150
|
+
listConfig?: ListConfig;
|
|
151
|
+
ganttConfig?: GanttConfig;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// =============================================================================
|
|
155
|
+
// API Input Types
|
|
156
|
+
// =============================================================================
|
|
19
157
|
|
|
20
|
-
// Input types for API operations
|
|
21
158
|
export interface CreateViewInput {
|
|
22
159
|
workspaceId?: string;
|
|
23
160
|
type: ViewType;
|
|
24
161
|
name: string;
|
|
25
162
|
description?: string;
|
|
26
163
|
initialContent?: unknown;
|
|
164
|
+
tableConfig?: TableViewConfig; // For table-based views
|
|
27
165
|
}
|
|
28
166
|
|
|
29
167
|
export interface UpdateViewInput {
|
|
30
168
|
name?: string;
|
|
31
169
|
description?: string;
|
|
32
170
|
metadata?: Record<string, unknown>;
|
|
171
|
+
tableConfig?: Partial<TableViewConfig>;
|
|
33
172
|
}
|
|
34
173
|
|
|
35
174
|
export interface SaveViewInput {
|
|
@@ -37,3 +176,8 @@ export interface SaveViewInput {
|
|
|
37
176
|
content: unknown;
|
|
38
177
|
saveType?: 'auto' | 'manual' | 'publish';
|
|
39
178
|
}
|
|
179
|
+
|
|
180
|
+
export interface SwitchViewLayoutInput {
|
|
181
|
+
viewId: string;
|
|
182
|
+
newLayout: TableViewConfig['layout'];
|
|
183
|
+
}
|
package/tsup.config.ts
CHANGED