@synap-core/types 1.2.7 → 1.2.10

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.
@@ -55,6 +55,38 @@ var ENTITY_SCHEMAS = {
55
55
  website: z.string().url().optional(),
56
56
  industry: z.string().optional(),
57
57
  foundedYear: z.number().int().optional()
58
+ }),
59
+ // Aliases/New types for API compatibility
60
+ contact: z.object({
61
+ email: z.string().email().optional(),
62
+ phone: z.string().optional(),
63
+ company: z.string().optional(),
64
+ role: z.string().optional(),
65
+ linkedInUrl: z.string().url().optional(),
66
+ twitterHandle: z.string().optional(),
67
+ notes: z.string().optional()
68
+ }),
69
+ meeting: z.object({
70
+ startTime: z.string().datetime(),
71
+ endTime: z.string().datetime(),
72
+ location: z.string().optional(),
73
+ attendees: z.array(z.string().uuid()).optional(),
74
+ recurring: z.boolean().default(false),
75
+ recurrenceRule: z.string().optional(),
76
+ isAllDay: z.boolean().default(false),
77
+ reminderMinutes: z.number().int().optional()
78
+ }),
79
+ idea: z.object({
80
+ tags: z.array(z.string()).default([]),
81
+ impact: z.enum(["low", "medium", "high"]).optional(),
82
+ effort: z.enum(["low", "medium", "high"]).optional()
83
+ }),
84
+ project: z.object({
85
+ status: z.enum(["active", "on_hold", "completed", "archived"]).default("active"),
86
+ priority: z.enum(["low", "medium", "high", "urgent"]).optional(),
87
+ dueDate: z.string().datetime().optional(),
88
+ completedAt: z.string().datetime().optional(),
89
+ owner: z.string().uuid().optional()
58
90
  })
59
91
  };
60
92
  function validateEntityMetadata(type, metadata) {
@@ -80,6 +112,7 @@ var baseEntitySchema = z2.object({
80
112
  fileSize: z2.number().nullable(),
81
113
  fileType: z2.string().nullable(),
82
114
  checksum: z2.string().nullable(),
115
+ projectIds: z2.array(z2.string()).nullable(),
83
116
  version: z2.number(),
84
117
  createdAt: z2.date(),
85
118
  updatedAt: z2.date(),
@@ -117,6 +150,22 @@ var EntitySchema = z2.discriminatedUnion("type", [
117
150
  baseEntitySchema.extend({
118
151
  type: z2.literal("company"),
119
152
  metadata: ENTITY_SCHEMAS.company
153
+ }),
154
+ baseEntitySchema.extend({
155
+ type: z2.literal("contact"),
156
+ metadata: ENTITY_SCHEMAS.contact
157
+ }),
158
+ baseEntitySchema.extend({
159
+ type: z2.literal("meeting"),
160
+ metadata: ENTITY_SCHEMAS.meeting
161
+ }),
162
+ baseEntitySchema.extend({
163
+ type: z2.literal("idea"),
164
+ metadata: ENTITY_SCHEMAS.idea
165
+ }),
166
+ baseEntitySchema.extend({
167
+ type: z2.literal("project"),
168
+ metadata: ENTITY_SCHEMAS.project
120
169
  })
121
170
  ]);
122
171
 
@@ -9,7 +9,7 @@ import {
9
9
  isTask,
10
10
  safeValidateEntityMetadata,
11
11
  validateEntityMetadata
12
- } from "../chunk-HFVZISQ7.js";
12
+ } from "../chunk-DYNDZON6.js";
13
13
  export {
14
14
  ENTITY_SCHEMAS,
15
15
  EntitySchema,
package/dist/index.js CHANGED
@@ -15,15 +15,6 @@ import {
15
15
  validateContentCategoryForViewType
16
16
  } from "./chunk-E4TRCFI3.js";
17
17
  import "./chunk-IZA3UKBT.js";
18
- import "./chunk-GX24H4PF.js";
19
- import {
20
- CustomThemeSchema,
21
- GraphPreferencesSchema,
22
- UIPreferencesSchema,
23
- UpdatePreferencesInputSchema,
24
- insertUserPreferenceSchema,
25
- selectUserPreferenceSchema
26
- } from "./chunk-MUAPS3OD.js";
27
18
  import {
28
19
  insertDocumentSessionSchema,
29
20
  insertDocumentVersionSchema,
@@ -41,7 +32,16 @@ import {
41
32
  isTask,
42
33
  safeValidateEntityMetadata,
43
34
  validateEntityMetadata
44
- } from "./chunk-HFVZISQ7.js";
35
+ } from "./chunk-DYNDZON6.js";
36
+ import "./chunk-GX24H4PF.js";
37
+ import {
38
+ CustomThemeSchema,
39
+ GraphPreferencesSchema,
40
+ UIPreferencesSchema,
41
+ UpdatePreferencesInputSchema,
42
+ insertUserPreferenceSchema,
43
+ selectUserPreferenceSchema
44
+ } from "./chunk-MUAPS3OD.js";
45
45
  import {
46
46
  insertProposalSchema,
47
47
  selectProposalSchema
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synap-core/types",
3
- "version": "1.2.7",
3
+ "version": "1.2.10",
4
4
  "description": "Shared TypeScript types and Zod schemas for the Synap platform",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -88,4 +88,4 @@
88
88
  "tsup": "^8.0.0",
89
89
  "typescript": "^5.6.0"
90
90
  }
91
- }
91
+ }
@@ -76,6 +76,44 @@ export const ENTITY_SCHEMAS = {
76
76
  industry: z.string().optional(),
77
77
  foundedYear: z.number().int().optional(),
78
78
  }),
79
+
80
+ // Aliases/New types for API compatibility
81
+ contact: z.object({
82
+ email: z.string().email().optional(),
83
+ phone: z.string().optional(),
84
+ company: z.string().optional(),
85
+ role: z.string().optional(),
86
+ linkedInUrl: z.string().url().optional(),
87
+ twitterHandle: z.string().optional(),
88
+ notes: z.string().optional(),
89
+ }),
90
+
91
+ meeting: z.object({
92
+ startTime: z.string().datetime(),
93
+ endTime: z.string().datetime(),
94
+ location: z.string().optional(),
95
+ attendees: z.array(z.string().uuid()).optional(),
96
+ recurring: z.boolean().default(false),
97
+ recurrenceRule: z.string().optional(),
98
+ isAllDay: z.boolean().default(false),
99
+ reminderMinutes: z.number().int().optional(),
100
+ }),
101
+
102
+ idea: z.object({
103
+ tags: z.array(z.string()).default([]),
104
+ impact: z.enum(["low", "medium", "high"]).optional(),
105
+ effort: z.enum(["low", "medium", "high"]).optional(),
106
+ }),
107
+
108
+ project: z.object({
109
+ status: z
110
+ .enum(["active", "on_hold", "completed", "archived"])
111
+ .default("active"),
112
+ priority: z.enum(["low", "medium", "high", "urgent"]).optional(),
113
+ dueDate: z.string().datetime().optional(),
114
+ completedAt: z.string().datetime().optional(),
115
+ owner: z.string().uuid().optional(),
116
+ }),
79
117
  } as const;
80
118
 
81
119
  /**
@@ -35,6 +35,7 @@ const baseEntitySchema = z.object({
35
35
  fileSize: z.number().nullable(),
36
36
  fileType: z.string().nullable(),
37
37
  checksum: z.string().nullable(),
38
+ projectIds: z.array(z.string()).nullable(),
38
39
  version: z.number(),
39
40
  createdAt: z.date(),
40
41
  updatedAt: z.date(),
@@ -75,6 +76,22 @@ export const EntitySchema = z.discriminatedUnion("type", [
75
76
  type: z.literal("company"),
76
77
  metadata: ENTITY_SCHEMAS.company,
77
78
  }),
79
+ baseEntitySchema.extend({
80
+ type: z.literal("contact"),
81
+ metadata: ENTITY_SCHEMAS.contact,
82
+ }),
83
+ baseEntitySchema.extend({
84
+ type: z.literal("meeting"),
85
+ metadata: ENTITY_SCHEMAS.meeting,
86
+ }),
87
+ baseEntitySchema.extend({
88
+ type: z.literal("idea"),
89
+ metadata: ENTITY_SCHEMAS.idea,
90
+ }),
91
+ baseEntitySchema.extend({
92
+ type: z.literal("project"),
93
+ metadata: ENTITY_SCHEMAS.project,
94
+ }),
78
95
  ]);
79
96
 
80
97
  /**
@@ -95,6 +112,10 @@ export type Note = Extract<Entity, { type: "note" }>;
95
112
  export type Person = Extract<Entity, { type: "person" }>;
96
113
  export type Event = Extract<Entity, { type: "event" }>;
97
114
  export type File = Extract<Entity, { type: "file" }>;
115
+ export type Contact = Extract<Entity, { type: "contact" }>;
116
+ export type Meeting = Extract<Entity, { type: "meeting" }>;
117
+ export type Idea = Extract<Entity, { type: "idea" }>;
118
+ export type Project = Extract<Entity, { type: "project" }>;
98
119
 
99
120
  /**
100
121
  * New entity type (for creation)
@@ -1 +0,0 @@
1
- export { Document, DocumentSession, NewDocumentSession, NewDocumentVersion, insertDocumentSessionSchema, insertDocumentVersionSchema, selectDocumentSessionSchema, selectDocumentVersionSchema } from '@synap/database/schema';
@@ -1,38 +0,0 @@
1
- import { E as Entity, T as Task, N as Note, P as Person, e as Event, F as File } from '../types-O93mCz6a.js';
2
- export { B as BaseEntity, a as ENTITY_SCHEMAS, c as EntityMetadata, d as EntitySchema, b as EntityType, f as NewEntity, U as UpdateEntity, s as safeValidateEntityMetadata, v as validateEntityMetadata } from '../types-O93mCz6a.js';
3
- import 'zod';
4
-
5
- /**
6
- * Entity Type Guards
7
- *
8
- * Type guard functions for narrowing entity types.
9
- */
10
-
11
- /**
12
- * Type guard for Task entities
13
- */
14
- declare function isTask(entity: Entity): entity is Task;
15
- /**
16
- * Type guard for Note entities
17
- */
18
- declare function isNote(entity: Entity): entity is Note;
19
- /**
20
- * Type guard for Person entities
21
- */
22
- declare function isPerson(entity: Entity): entity is Person;
23
- /**
24
- * Type guard for Event entities
25
- */
26
- declare function isEvent(entity: Entity): entity is Event;
27
- /**
28
- * Type guard for File entities
29
- */
30
- declare function isFile(entity: Entity): entity is File;
31
- /**
32
- * Generic type guard for any entity type
33
- */
34
- declare function isEntityOfType<T extends Entity["type"]>(entity: Entity, type: T): entity is Extract<Entity, {
35
- type: T;
36
- }>;
37
-
38
- export { Entity, Event, File, Note, Person, Task, isEntityOfType, isEvent, isFile, isNote, isPerson, isTask };
@@ -1,139 +0,0 @@
1
- import { E as Entity } from '../types-O93mCz6a.js';
2
- import 'zod';
3
-
4
- /**
5
- * Domain Event Types
6
- *
7
- * Type definitions for Socket.IO domain events.
8
- * These are emitted by Inngest workers via the realtime bridge
9
- * to notify clients about data changes.
10
- *
11
- * SINGLE SOURCE OF TRUTH - Frontend imports from here.
12
- */
13
-
14
- interface EntityCreatedEvent {
15
- entityId: string;
16
- workspaceId: string;
17
- type: string;
18
- title: string;
19
- entity?: Entity;
20
- createdBy: string;
21
- createdAt: string;
22
- }
23
- interface EntityUpdatedEvent {
24
- entityId: string;
25
- workspaceId: string;
26
- changes: Record<string, unknown>;
27
- entity?: Entity;
28
- updatedBy: string;
29
- updatedAt: string;
30
- }
31
- interface EntityDeletedEvent {
32
- entityId: string;
33
- workspaceId: string;
34
- deletedBy: string;
35
- deletedAt: string;
36
- }
37
- interface EntityApprovalEvent {
38
- requestId: string;
39
- entityId?: string;
40
- workspaceId: string;
41
- entityType: string;
42
- status: "pending" | "approved" | "rejected" | "created";
43
- reason?: string;
44
- createdBy: string;
45
- timestamp: string;
46
- }
47
- interface DocumentUpdatedEvent {
48
- documentId: string;
49
- workspaceId: string;
50
- version: number;
51
- updatedBy: string;
52
- updatedAt: string;
53
- }
54
- interface DocumentVersionCreatedEvent {
55
- documentId: string;
56
- workspaceId: string;
57
- version: number;
58
- message?: string;
59
- createdBy: string;
60
- createdAt: string;
61
- }
62
- interface AIProposalEvent {
63
- proposalId: string;
64
- workspaceId: string;
65
- targetType: "entity" | "document";
66
- targetId?: string;
67
- operation: "create" | "update" | "delete";
68
- data: unknown;
69
- reasoning: string;
70
- confidence: number;
71
- createdAt: string;
72
- }
73
- interface AIProposalStatusEvent {
74
- proposalId: string;
75
- workspaceId: string;
76
- status: "approved" | "rejected";
77
- processedBy: string;
78
- processedAt: string;
79
- }
80
- interface ChatMessageEvent {
81
- threadId: string;
82
- messageId: string;
83
- workspaceId: string;
84
- role: "user" | "assistant";
85
- content: string;
86
- createdAt: string;
87
- }
88
- interface ChatStreamEvent {
89
- threadId: string;
90
- messageId: string;
91
- chunk: string;
92
- done: boolean;
93
- }
94
- /**
95
- * All domain events emitted from server to client.
96
- * Use this for typed Socket.IO client setup.
97
- */
98
- interface DomainServerToClientEvents {
99
- "entity:created": (data: EntityCreatedEvent) => void;
100
- "entity:updated": (data: EntityUpdatedEvent) => void;
101
- "entity:deleted": (data: EntityDeletedEvent) => void;
102
- "entity:approval": (data: EntityApprovalEvent) => void;
103
- "document:updated": (data: DocumentUpdatedEvent) => void;
104
- "document:version": (data: DocumentVersionCreatedEvent) => void;
105
- "ai:proposal": (data: AIProposalEvent) => void;
106
- "ai:proposal:status": (data: AIProposalStatusEvent) => void;
107
- "chat:message": (data: ChatMessageEvent) => void;
108
- "chat:stream": (data: ChatStreamEvent) => void;
109
- error: (data: {
110
- code: string;
111
- message: string;
112
- }) => void;
113
- }
114
- /**
115
- * Events clients can send to server.
116
- */
117
- interface DomainClientToServerEvents {
118
- "join-workspace": (workspaceId: string) => void;
119
- "leave-workspace": (workspaceId: string) => void;
120
- "join-document": (documentId: string) => void;
121
- "leave-document": (documentId: string) => void;
122
- }
123
- /**
124
- * All domain event names for type checking
125
- */
126
- declare const DomainEventNames: {
127
- readonly ENTITY_CREATED: "entity:created";
128
- readonly ENTITY_UPDATED: "entity:updated";
129
- readonly ENTITY_DELETED: "entity:deleted";
130
- readonly DOCUMENT_UPDATED: "document:updated";
131
- readonly DOCUMENT_VERSION: "document:version";
132
- readonly AI_PROPOSAL: "ai:proposal";
133
- readonly AI_PROPOSAL_STATUS: "ai:proposal:status";
134
- readonly CHAT_MESSAGE: "chat:message";
135
- readonly CHAT_STREAM: "chat:stream";
136
- };
137
- type DomainEventName = (typeof DomainEventNames)[keyof typeof DomainEventNames];
138
-
139
- export { type AIProposalEvent, type AIProposalStatusEvent, type ChatMessageEvent, type ChatStreamEvent, type DocumentUpdatedEvent, type DocumentVersionCreatedEvent, type DomainClientToServerEvents, type DomainEventName, DomainEventNames, type DomainServerToClientEvents, type EntityApprovalEvent, type EntityCreatedEvent, type EntityDeletedEvent, type EntityUpdatedEvent };
@@ -1,2 +0,0 @@
1
-
2
- export { }