@synap-core/types 0.3.3 → 0.3.5

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.
@@ -42,46 +42,6 @@ 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
85
45
  })
86
46
  };
87
47
  function validateEntityMetadata(type, metadata) {
@@ -1,12 +1,12 @@
1
- import { Document } from '@synap/database/schema';
2
- export { Document, DocumentSession, DocumentVersion, NewDocument, NewDocumentSession, NewDocumentVersion } from '@synap/database/schema';
1
+ import { Document } from '@synap-core/database/schema';
2
+ export { Document, DocumentSession, DocumentVersion, NewDocument, NewDocumentSession, NewDocumentVersion } from '@synap-core/database/schema';
3
3
 
4
4
  /**
5
5
  * Document Types
6
6
  *
7
7
  * Re-exports document types from database schema (single source of truth).
8
8
  *
9
- * @see {@link file:///.../packages/database/src/schema/documents.ts}
9
+ * @see {@link @synap-core/database/schema}
10
10
  */
11
11
 
12
12
  type UpdateDocument = Partial<Omit<Document, 'id' | 'userId' | 'createdAt' | 'updatedAt'>>;
@@ -1,5 +1,4 @@
1
1
  import { z } from 'zod';
2
- export { Entity as DBEntity, NewEntity as NewEntityDB } from '@synap/database/schema';
3
2
 
4
3
  /**
5
4
  * Entity Metadata Schemas
@@ -129,90 +128,6 @@ declare const ENTITY_SCHEMAS: {
129
128
  thumbnailUrl?: string | undefined;
130
129
  downloadUrl?: string | undefined;
131
130
  }>;
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
- }>;
216
131
  };
217
132
  /**
218
133
  * Entity type enum - auto-generated from schema keys
@@ -304,68 +219,13 @@ declare function safeValidateEntityMetadata<T extends EntityType>(type: T, metad
304
219
  extension: string;
305
220
  thumbnailUrl?: string | undefined;
306
221
  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;
361
222
  }>;
362
223
 
363
224
  /**
364
225
  * Entity Types
365
226
  *
366
- * Re-exports base entity types from database and adds discriminated unions.
367
- *
368
- * @see {@link file:///.../packages/database/src/schema/entities.ts}
227
+ * TypeScript types for entities with discriminated unions.
228
+ * Types are automatically generated from Zod schemas.
369
229
  */
370
230
 
371
231
  /**
@@ -8,7 +8,7 @@ import {
8
8
  isTask,
9
9
  safeValidateEntityMetadata,
10
10
  validateEntityMetadata
11
- } from "../chunk-RIUK6OEK.js";
11
+ } from "../chunk-OPLFDITK.js";
12
12
  export {
13
13
  ENTITY_SCHEMAS,
14
14
  isEntityOfType,
@@ -1,6 +1,15 @@
1
- import {
2
- DomainEventNames
3
- } from "../chunk-6OHYLFUB.js";
1
+ // src/events/index.ts
2
+ var DomainEventNames = {
3
+ ENTITY_CREATED: "entity:created",
4
+ ENTITY_UPDATED: "entity:updated",
5
+ ENTITY_DELETED: "entity:deleted",
6
+ DOCUMENT_UPDATED: "document:updated",
7
+ DOCUMENT_VERSION: "document:version",
8
+ AI_PROPOSAL: "ai:proposal",
9
+ AI_PROPOSAL_STATUS: "ai:proposal:status",
10
+ CHAT_MESSAGE: "chat:message",
11
+ CHAT_STREAM: "chat:stream"
12
+ };
4
13
  export {
5
14
  DomainEventNames
6
15
  };
@@ -1,12 +1,12 @@
1
1
  import { z } from 'zod';
2
- export { InboxItem as DBInboxItem, NewInboxItem } from '@synap/database/schema';
2
+ export { InboxItem as DBInboxItem, NewInboxItem } from '@synap-core/database/schema';
3
3
 
4
4
  /**
5
5
  * Inbox Item Schemas & Types
6
6
  *
7
7
  * Re-exports inbox types from database and adds provider-specific schemas.
8
8
  *
9
- * @see {@link file:///.../packages/database/src/schema/inbox-items.ts}
9
+ * @see {@link @synap-core/database/schema}
10
10
  */
11
11
 
12
12
  /**
package/dist/index.d.ts CHANGED
@@ -1,12 +1,5 @@
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, NewRelation, NewUserEntityState, NewUserPreference as NewUserPreferences, NewView, NewWorkspace, NewWorkspaceInvite, NewWorkspaceMember, ReasoningTrace, Relation, UserEntityState, UserPreference as UserPreferences, View, Workspace, WorkspaceInvite, WorkspaceMember } from '@synap/database/schema';
3
+ export { InboxItem as DBInboxItem, Document, DocumentSession, DocumentVersion, EntityEnrichment, EntityRelationship, NewDocument, NewDocumentSession, NewDocumentVersion, NewEntityEnrichment, NewEntityRelationship, NewInboxItem, NewReasoningTrace, NewUserEntityState, ReasoningTrace, UserEntityState } from '@synap-core/database/schema';
4
4
  export { CalendarInboxItem, EmailInboxItem, INBOX_SCHEMAS, InboxItem, InboxItemType, SlackInboxItem, isCalendarInboxItem, isEmailInboxItem, isSlackInboxItem } from './inbox/index.js';
5
- export { CreateWorkspaceInput, InviteMemberInput, UpdateWorkspaceInput, WorkspaceRole, WorkspaceType } from './workspaces/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';
8
- export { Theme, UpdatePreferencesInput } from './preferences/index.js';
9
- export { CollaborationEvent, CursorUpdate, PresenceInit, PresenceStatus, UserJoinedEvent, UserLeftEvent, UserPresence } from './realtime/index.js';
10
- export { AIProposalEvent, AIProposalStatusEvent, ChatMessageEvent, ChatStreamEvent, DocumentUpdatedEvent, DocumentVersionCreatedEvent, DomainClientToServerEvents, DomainEventName, DomainEventNames, DomainServerToClientEvents, EntityCreatedEvent, EntityDeletedEvent, EntityUpdatedEvent } from './events/index.js';
11
- export { Array as YArray, Doc as YDoc, Map as YMap, Text as YText } from 'yjs';
12
5
  import 'zod';
package/dist/index.js CHANGED
@@ -1,11 +1,3 @@
1
- import {
2
- INBOX_SCHEMAS,
3
- isCalendarInboxItem,
4
- isEmailInboxItem,
5
- isSlackInboxItem
6
- } from "./chunk-ZFFMXKF2.js";
7
- import "./chunk-2BEUWD3P.js";
8
- import "./chunk-IZA3UKBT.js";
9
1
  import "./chunk-7LKCNZXD.js";
10
2
  import {
11
3
  ENTITY_SCHEMAS,
@@ -17,16 +9,15 @@ import {
17
9
  isTask,
18
10
  safeValidateEntityMetadata,
19
11
  validateEntityMetadata
20
- } from "./chunk-RIUK6OEK.js";
12
+ } from "./chunk-OPLFDITK.js";
21
13
  import {
22
- DomainEventNames
23
- } from "./chunk-6OHYLFUB.js";
24
- import "./chunk-QAWJ6GM3.js";
14
+ INBOX_SCHEMAS,
15
+ isCalendarInboxItem,
16
+ isEmailInboxItem,
17
+ isSlackInboxItem
18
+ } from "./chunk-ZFFMXKF2.js";
25
19
  import "./chunk-2N5ZC5EB.js";
26
- import "./chunk-X5L3VJJZ.js";
27
- import "./chunk-ZTGPGYVX.js";
28
20
  export {
29
- DomainEventNames,
30
21
  ENTITY_SCHEMAS,
31
22
  INBOX_SCHEMAS,
32
23
  isCalendarInboxItem,
@@ -1,14 +1,12 @@
1
- import { UserPreference } from '@synap/database/schema';
2
- export { NewUserPreference as NewUserPreferences, UserPreference as UserPreferences } from '@synap/database/schema';
1
+ import { UserPreference } from '@synap-core/database/schema';
2
+ export { NewUserPreference as NewUserPreferences, UserPreference as UserPreferences } from '@synap-core/database/schema';
3
3
 
4
4
  /**
5
5
  * User Preferences Types
6
6
  *
7
7
  * Re-exports user preferences types from database schema (single source of truth).
8
8
  *
9
- * Note: Database exports `UserPreference` (singular), we alias to `UserPreferences` for API consistency.
10
- *
11
- * @see {@link file:///.../packages/database/src/schema/user-preferences.ts}
9
+ * @see {@link @synap-core/database/schema}
12
10
  */
13
11
 
14
12
  type Theme = UserPreference['theme'];
@@ -1 +0,0 @@
1
- import "../chunk-2BEUWD3P.js";
@@ -1 +0,0 @@
1
- import "../chunk-X5L3VJJZ.js";
@@ -1,11 +1,11 @@
1
- export { NewRelation, Relation } from '@synap/database/schema';
1
+ export { NewRelation, Relation } from '@synap-core/database/schema';
2
2
 
3
3
  /**
4
4
  * Relation Types
5
5
  *
6
6
  * Re-exports relation types from database schema (single source of truth).
7
7
  *
8
- * @see {@link file:///.../packages/database/src/schema/relations.ts}
8
+ * @see {@link @synap-core/database/schema}
9
9
  */
10
10
 
11
11
  type RelationType = 'related_to' | 'parent_of' | 'child_of' | 'blocks' | 'mentioned_in' | 'linked_to';
@@ -1 +0,0 @@
1
- import "../chunk-QAWJ6GM3.js";
@@ -1 +1 @@
1
- export { EntityEnrichment, EntityRelationship, NewEntityEnrichment, NewEntityRelationship, NewReasoningTrace, NewUserEntityState, ReasoningTrace, UserEntityState } from '@synap/database/schema';
1
+ export { EntityEnrichment, EntityRelationship, NewEntityEnrichment, NewEntityRelationship, NewReasoningTrace, NewUserEntityState, ReasoningTrace, UserEntityState } from '@synap-core/database/schema';
@@ -1,4 +1,4 @@
1
- export { NewView, View } from '@synap/database/schema';
1
+ export { NewView, View } from '@synap-core/database/schema';
2
2
 
3
3
  /**
4
4
  * View Types
@@ -6,20 +6,13 @@ export { NewView, View } from '@synap/database/schema';
6
6
  * Re-exports view types from database schema (single source of truth).
7
7
  * Extended with Table Inversion System configuration types.
8
8
  *
9
- * @see {@link file:///.../packages/database/src/schema/views.ts}
9
+ * @see {@link @synap-core/database/schema}
10
10
  */
11
11
 
12
12
  /**
13
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
14
  */
19
15
  type ViewType = 'whiteboard' | 'table' | 'kanban' | 'list' | 'grid' | 'gallery' | 'calendar' | 'gantt' | 'timeline' | 'mindmap' | 'graph';
20
- /**
21
- * Column definition for table-based views
22
- */
23
16
  interface ColumnDefinition {
24
17
  id: string;
25
18
  name: string;
@@ -30,83 +23,21 @@ interface ColumnDefinition {
30
23
  width?: number;
31
24
  isHidden?: boolean;
32
25
  }
33
- /**
34
- * Filter rule for views
35
- */
36
26
  interface FilterRule {
37
27
  columnId: string;
38
28
  operator: 'equals' | 'not_equals' | 'contains' | 'not_contains' | 'is_empty' | 'is_not_empty' | 'greater_than' | 'less_than' | 'date_is' | 'date_before' | 'date_after';
39
29
  value?: unknown;
40
30
  }
41
- /**
42
- * Sort rule for views
43
- */
44
31
  interface SortRule {
45
32
  columnId: string;
46
33
  direction: 'asc' | 'desc';
47
34
  }
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
35
  interface TableViewConfig {
100
36
  layout: 'table' | 'kanban' | 'list' | 'grid' | 'gallery' | 'calendar' | 'gantt' | 'timeline';
101
37
  columns: ColumnDefinition[];
102
38
  filters?: FilterRule[];
103
39
  sorts?: SortRule[];
104
40
  groupByColumnId?: string;
105
- kanbanConfig?: KanbanConfig;
106
- calendarConfig?: CalendarConfig;
107
- gridConfig?: GridConfig;
108
- listConfig?: ListConfig;
109
- ganttConfig?: GanttConfig;
110
41
  }
111
42
  interface CreateViewInput {
112
43
  workspaceId?: string;
@@ -122,14 +53,5 @@ interface UpdateViewInput {
122
53
  metadata?: Record<string, unknown>;
123
54
  tableConfig?: Partial<TableViewConfig>;
124
55
  }
125
- interface SaveViewInput {
126
- viewId: string;
127
- content: unknown;
128
- saveType?: 'auto' | 'manual' | 'publish';
129
- }
130
- interface SwitchViewLayoutInput {
131
- viewId: string;
132
- newLayout: TableViewConfig['layout'];
133
- }
134
56
 
135
- export type { CalendarConfig, ColumnDefinition, CreateViewInput, FilterRule, GanttConfig, GridConfig, KanbanConfig, ListConfig, SaveViewInput, SortRule, SwitchViewLayoutInput, TableViewConfig, UpdateViewInput, ViewType };
57
+ export type { ColumnDefinition, CreateViewInput, FilterRule, SortRule, TableViewConfig, UpdateViewInput, ViewType };
@@ -1 +0,0 @@
1
- import "../chunk-ZTGPGYVX.js";
@@ -1,12 +1,12 @@
1
- import { Workspace, WorkspaceMember } from '@synap/database/schema';
2
- export { NewWorkspace, NewWorkspaceInvite, NewWorkspaceMember, Workspace, WorkspaceInvite, WorkspaceMember } from '@synap/database/schema';
1
+ import { Workspace, WorkspaceMember } from '@synap-core/database/schema';
2
+ export { NewWorkspace, NewWorkspaceInvite, NewWorkspaceMember, Workspace, WorkspaceInvite, WorkspaceMember } from '@synap-core/database/schema';
3
3
 
4
4
  /**
5
5
  * Workspace Types
6
6
  *
7
7
  * Re-exports workspace types from database schema (single source of truth).
8
8
  *
9
- * @see {@link file:///.../packages/database/src/schema/workspaces.ts}
9
+ * @see {@link @synap-core/database/schema}
10
10
  */
11
11
 
12
12
  type WorkspaceType = Workspace['type'];
@@ -1 +0,0 @@
1
- import "../chunk-IZA3UKBT.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synap-core/types",
3
- "version": "0.3.3",
3
+ "version": "0.3.5",
4
4
  "type": "module",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -53,7 +53,13 @@
53
53
  "import": "./dist/events/index.js"
54
54
  }
55
55
  },
56
+ "scripts": {
57
+ "build": "tsup",
58
+ "dev": "tsup --watch",
59
+ "type-check": "tsc --noEmit"
60
+ },
56
61
  "dependencies": {
62
+ "@synap-core/database": "^0.1.1",
57
63
  "zod": "^3.25.0",
58
64
  "yjs": "^13.6.11"
59
65
  },
@@ -61,18 +67,5 @@
61
67
  "@types/node": "^20.0.0",
62
68
  "tsup": "^8.0.0",
63
69
  "typescript": "^5.6.0"
64
- },
65
- "peerDependencies": {
66
- "@synap/database": "1.0.0"
67
- },
68
- "peerDependenciesMeta": {
69
- "@synap/database": {
70
- "optional": true
71
- }
72
- },
73
- "scripts": {
74
- "build": "tsup",
75
- "dev": "tsup --watch",
76
- "type-check": "tsc --noEmit"
77
70
  }
78
71
  }
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Re-exports document types from database schema (single source of truth).
5
5
  *
6
- * @see {@link file:///.../packages/database/src/schema/documents.ts}
6
+ * @see {@link @synap-core/database/schema}
7
7
  */
8
8
 
9
9
  // Direct re-exports from database
@@ -14,9 +14,9 @@ export type {
14
14
  NewDocumentVersion,
15
15
  DocumentSession,
16
16
  NewDocumentSession,
17
- } from '@synap/database/schema';
17
+ } from '@synap-core/database/schema';
18
18
 
19
19
  // Derived/helper types for API operations
20
- import type { Document } from '@synap/database/schema';
20
+ import type { Document } from '@synap-core/database/schema';
21
21
 
22
22
  export type UpdateDocument = Partial<Omit<Document, 'id' | 'userId' | 'createdAt' | 'updatedAt'>>;
@@ -60,44 +60,6 @@ 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
- }),
101
63
  } as const;
102
64
 
103
65
  /**
@@ -1,17 +1,10 @@
1
1
  /**
2
2
  * Entity Types
3
3
  *
4
- * Re-exports base entity types from database and adds discriminated unions.
5
- *
6
- * @see {@link file:///.../packages/database/src/schema/entities.ts}
4
+ * TypeScript types for entities with discriminated unions.
5
+ * Types are automatically generated from Zod schemas.
7
6
  */
8
7
 
9
- // Direct re-exports from database
10
- export type {
11
- Entity as DBEntity, // Alias to avoid conflict with our discriminated union
12
- NewEntity as NewEntityDB,
13
- } from '@synap/database/schema';
14
-
15
8
  import type { EntityType, EntityMetadata } from './schemas.js';
16
9
 
17
10
  /**
@@ -3,16 +3,16 @@
3
3
  *
4
4
  * Re-exports inbox types from database and adds provider-specific schemas.
5
5
  *
6
- * @see {@link file:///.../packages/database/src/schema/inbox-items.ts}
6
+ * @see {@link @synap-core/database/schema}
7
7
  */
8
8
 
9
9
  import { z } from 'zod';
10
10
 
11
11
  // Direct re-exports from database
12
12
  export type {
13
- InboxItem as DBInboxItem, // Base DB type
13
+ InboxItem as DBInboxItem,
14
14
  NewInboxItem,
15
- } from '@synap/database/schema';
15
+ } from '@synap-core/database/schema';
16
16
 
17
17
  /**
18
18
  * Inbox item data schemas - provider-specific
@@ -63,28 +63,18 @@ type InboxItemData = {
63
63
  interface BaseInboxItem {
64
64
  id: string;
65
65
  userId: string;
66
-
67
- // Source tracking
68
66
  provider: 'gmail' | 'google_calendar' | 'slack';
69
- account: string; // 'user@gmail.com'
70
- externalId: string; // ID in external system
71
- deepLink?: string; // 'googlegmail://message?id=...'
72
-
73
- // Content
67
+ account: string;
68
+ externalId: string;
69
+ deepLink?: string;
74
70
  type: InboxItemType;
75
71
  title: string;
76
72
  preview?: string;
77
73
  timestamp: Date;
78
-
79
- // State
80
74
  status: 'unread' | 'read' | 'archived' | 'snoozed';
81
75
  snoozedUntil?: Date;
82
-
83
- // AI enhancements
84
76
  priority?: 'urgent' | 'high' | 'normal' | 'low';
85
77
  tags: string[];
86
-
87
- // Lifecycle
88
78
  processedAt?: Date;
89
79
  createdAt: Date;
90
80
  updatedAt: Date;
package/src/index.ts CHANGED
@@ -3,8 +3,6 @@
3
3
  *
4
4
  * Core type definitions for the Synap ecosystem.
5
5
  * Used by frontend, backend, and Intelligence Hub.
6
- *
7
- * All types re-export from database schemas to maintain single source of truth.
8
6
  */
9
7
 
10
8
  // Entity types
@@ -16,24 +14,5 @@ export * from './documents/index.js';
16
14
  // User and context types
17
15
  export * from './users/index.js';
18
16
 
19
- // Inbox types
17
+ // Inbox types
20
18
  export * from './inbox/index.js';
21
-
22
- // Workspace types (V3.0)
23
- export * from './workspaces/index.js';
24
-
25
- // View types (V3.0) - Extended with Table Inversion System
26
- export * from './views/index.js';
27
-
28
- // Relation types (V3.1) - Knowledge graph edges
29
- export * from './relations/index.js';
30
-
31
- // Preferences types (V3.0)
32
- export * from './preferences/index.js';
33
-
34
- // Real-time collaboration types (V3.0)
35
- export * from './realtime/index.js';
36
-
37
- // Domain event types for Socket.IO (V3.0)
38
- export * from './events/index.js';
39
-
@@ -3,19 +3,17 @@
3
3
  *
4
4
  * Re-exports user preferences types from database schema (single source of truth).
5
5
  *
6
- * Note: Database exports `UserPreference` (singular), we alias to `UserPreferences` for API consistency.
7
- *
8
- * @see {@link file:///.../packages/database/src/schema/user-preferences.ts}
6
+ * @see {@link @synap-core/database/schema}
9
7
  */
10
8
 
11
- // Direct re-exports from database (with alias for consistency)
9
+ // Direct re-exports from database
12
10
  export type {
13
11
  UserPreference as UserPreferences,
14
12
  NewUserPreference as NewUserPreferences,
15
- } from '@synap/database/schema';
13
+ } from '@synap-core/database/schema';
16
14
 
17
15
  // Derived types
18
- import type { UserPreference } from '@synap/database/schema';
16
+ import type { UserPreference } from '@synap-core/database/schema';
19
17
 
20
18
  export type Theme = UserPreference['theme'];
21
19
 
@@ -3,14 +3,14 @@
3
3
  *
4
4
  * Re-exports relation types from database schema (single source of truth).
5
5
  *
6
- * @see {@link file:///.../packages/database/src/schema/relations.ts}
6
+ * @see {@link @synap-core/database/schema}
7
7
  */
8
8
 
9
9
  // Direct re-exports from database
10
10
  export type {
11
11
  Relation,
12
12
  NewRelation,
13
- } from '@synap/database/schema';
13
+ } from '@synap-core/database/schema';
14
14
 
15
15
  // Relation type definitions
16
16
  export type RelationType =
@@ -1,10 +1,9 @@
1
1
  /**
2
2
  * User Types
3
3
  *
4
- * Re-exports user-related types from database and adds custom types.
4
+ * Re-exports user-related types from database schema.
5
5
  *
6
- * @see {@link file:///.../packages/database/src/schema/user-entity-state.ts}
7
- * @see {@link file:///.../packages/database/src/schema/enrichments.ts}
6
+ * @see {@link @synap-core/database/schema}
8
7
  */
9
8
 
10
9
  // Direct re-exports from database
@@ -17,4 +16,4 @@ export type {
17
16
  NewEntityRelationship,
18
17
  ReasoningTrace,
19
18
  NewReasoningTrace,
20
- } from '@synap/database/schema';
19
+ } from '@synap-core/database/schema';
@@ -4,14 +4,14 @@
4
4
  * Re-exports view types from database schema (single source of truth).
5
5
  * Extended with Table Inversion System configuration types.
6
6
  *
7
- * @see {@link file:///.../packages/database/src/schema/views.ts}
7
+ * @see {@link @synap-core/database/schema}
8
8
  */
9
9
 
10
10
  // Direct re-exports from database
11
11
  export type {
12
12
  View,
13
13
  NewView,
14
- } from '@synap/database/schema';
14
+ } from '@synap-core/database/schema';
15
15
 
16
16
  // =============================================================================
17
17
  // View Type Enum
@@ -19,136 +19,55 @@ export type {
19
19
 
20
20
  /**
21
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
22
  */
27
23
  export type ViewType =
28
24
  // 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
-
25
+ | 'whiteboard'
26
+ // Table-based (Table Inversion System)
27
+ | 'table'
28
+ | 'kanban'
29
+ | 'list'
30
+ | 'grid'
31
+ | 'gallery'
32
+ | 'calendar'
33
+ | 'gantt'
34
+ | 'timeline'
41
35
  // Specialized
42
- | 'mindmap' // Hierarchical tree visualization
43
- | 'graph'; // Knowledge graph visualization
36
+ | 'mindmap'
37
+ | 'graph';
44
38
 
45
39
  // =============================================================================
46
40
  // Table Inversion System Configuration
47
41
  // =============================================================================
48
42
 
49
- /**
50
- * Column definition for table-based views
51
- */
52
43
  export interface ColumnDefinition {
53
44
  id: string;
54
45
  name: string;
55
46
  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
47
+ options?: string[];
48
+ relationTableId?: string;
49
+ formula?: string;
50
+ width?: number;
51
+ isHidden?: boolean;
61
52
  }
62
53
 
63
- /**
64
- * Filter rule for views
65
- */
66
54
  export interface FilterRule {
67
55
  columnId: string;
68
56
  operator: 'equals' | 'not_equals' | 'contains' | 'not_contains' | 'is_empty' | 'is_not_empty' | 'greater_than' | 'less_than' | 'date_is' | 'date_before' | 'date_after';
69
57
  value?: unknown;
70
58
  }
71
59
 
72
- /**
73
- * Sort rule for views
74
- */
75
60
  export interface SortRule {
76
61
  columnId: string;
77
62
  direction: 'asc' | 'desc';
78
63
  }
79
64
 
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
65
  export interface TableViewConfig {
137
- // Current layout mode
138
66
  layout: 'table' | 'kanban' | 'list' | 'grid' | 'gallery' | 'calendar' | 'gantt' | 'timeline';
139
-
140
- // Universal settings (apply to all layouts)
141
67
  columns: ColumnDefinition[];
142
68
  filters?: FilterRule[];
143
69
  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;
70
+ groupByColumnId?: string;
152
71
  }
153
72
 
154
73
  // =============================================================================
@@ -161,7 +80,7 @@ export interface CreateViewInput {
161
80
  name: string;
162
81
  description?: string;
163
82
  initialContent?: unknown;
164
- tableConfig?: TableViewConfig; // For table-based views
83
+ tableConfig?: TableViewConfig;
165
84
  }
166
85
 
167
86
  export interface UpdateViewInput {
@@ -170,14 +89,3 @@ export interface UpdateViewInput {
170
89
  metadata?: Record<string, unknown>;
171
90
  tableConfig?: Partial<TableViewConfig>;
172
91
  }
173
-
174
- export interface SaveViewInput {
175
- viewId: string;
176
- content: unknown;
177
- saveType?: 'auto' | 'manual' | 'publish';
178
- }
179
-
180
- export interface SwitchViewLayoutInput {
181
- viewId: string;
182
- newLayout: TableViewConfig['layout'];
183
- }
@@ -3,10 +3,10 @@
3
3
  *
4
4
  * Re-exports workspace types from database schema (single source of truth).
5
5
  *
6
- * @see {@link file:///.../packages/database/src/schema/workspaces.ts}
6
+ * @see {@link @synap-core/database/schema}
7
7
  */
8
8
 
9
- // Direct re-exports from database (automatic sync, no manual maintenance needed)
9
+ // Direct re-exports from database
10
10
  export type {
11
11
  Workspace,
12
12
  NewWorkspace,
@@ -14,10 +14,10 @@ export type {
14
14
  NewWorkspaceMember,
15
15
  WorkspaceInvite,
16
16
  NewWorkspaceInvite,
17
- } from '@synap/database/schema';
17
+ } from '@synap-core/database/schema';
18
18
 
19
19
  // Derived types for API convenience
20
- import type { Workspace, WorkspaceMember } from '@synap/database/schema';
20
+ import type { Workspace, WorkspaceMember } from '@synap-core/database/schema';
21
21
 
22
22
  export type WorkspaceType = Workspace['type'];
23
23
  export type WorkspaceRole = WorkspaceMember['role'];
File without changes
@@ -1,16 +0,0 @@
1
- // src/events/index.ts
2
- var DomainEventNames = {
3
- ENTITY_CREATED: "entity:created",
4
- ENTITY_UPDATED: "entity:updated",
5
- ENTITY_DELETED: "entity:deleted",
6
- DOCUMENT_UPDATED: "document:updated",
7
- DOCUMENT_VERSION: "document:version",
8
- AI_PROPOSAL: "ai:proposal",
9
- AI_PROPOSAL_STATUS: "ai:proposal:status",
10
- CHAT_MESSAGE: "chat:message",
11
- CHAT_STREAM: "chat:stream"
12
- };
13
-
14
- export {
15
- DomainEventNames
16
- };
File without changes
File without changes
File without changes
File without changes