@synap-core/types 0.3.5 → 1.0.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.
Files changed (54) hide show
  1. package/.turbo/turbo-build.log +46 -29
  2. package/dist/{chunk-OPLFDITK.js → chunk-27HQLZOR.js} +34 -0
  3. package/dist/chunk-5MS6TR4O.js +124 -0
  4. package/dist/chunk-75HLKBPD.js +81 -0
  5. package/dist/chunk-IZA3UKBT.js +0 -0
  6. package/dist/chunk-QAWJ6GM3.js +0 -0
  7. package/dist/chunk-WXJ4PQR7.js +22 -0
  8. package/dist/chunk-X5L3VJJZ.js +0 -0
  9. package/dist/documents/index.js +20 -1
  10. package/dist/entities/index.js +5 -1
  11. package/dist/inbox/index.js +1 -12
  12. package/dist/index.js +584 -13
  13. package/dist/preferences/index.js +16 -0
  14. package/dist/realtime/index.js +1 -0
  15. package/dist/relations/index.js +1 -0
  16. package/dist/views/index.js +28 -0
  17. package/dist/workspaces/index.js +1 -0
  18. package/package.json +24 -4
  19. package/src/documents/index.ts +17 -11
  20. package/src/entities/schemas.ts +17 -0
  21. package/src/entities/types.ts +47 -33
  22. package/src/events/index.ts +4 -0
  23. package/src/inbox/index.ts +0 -113
  24. package/src/index.ts +24 -0
  25. package/src/preferences/index.ts +34 -19
  26. package/src/preferences/schemas.ts +87 -0
  27. package/src/relations/index.ts +2 -2
  28. package/src/templates/classic-note.template.ts +107 -0
  29. package/src/templates/index.ts +65 -0
  30. package/src/templates/notion-like.template.ts +138 -0
  31. package/src/templates/schemas.ts +181 -0
  32. package/src/templates/types.ts +227 -0
  33. package/src/templates/wiki-reference.template.ts +120 -0
  34. package/src/users/index.ts +2 -2
  35. package/src/views/config.ts +129 -0
  36. package/src/views/index.ts +17 -47
  37. package/src/views/query.ts +78 -0
  38. package/src/views/schema.ts +36 -0
  39. package/src/views/schemas.ts +173 -0
  40. package/src/views/types.ts +201 -0
  41. package/src/workspaces/index.ts +3 -3
  42. package/dist/chunk-ZFFMXKF2.js +0 -49
  43. package/dist/documents/index.d.ts +0 -14
  44. package/dist/entities/index.d.ts +0 -327
  45. package/dist/events/index.d.ts +0 -122
  46. package/dist/inbox/index.d.ts +0 -164
  47. package/dist/index.d.ts +0 -5
  48. package/dist/preferences/index.d.ts +0 -21
  49. package/dist/realtime/index.d.ts +0 -77
  50. package/dist/relations/index.d.ts +0 -36
  51. package/dist/users/index.d.ts +0 -1
  52. package/dist/views/index.d.ts +0 -57
  53. package/dist/workspaces/index.d.ts +0 -30
  54. /package/dist/{chunk-7LKCNZXD.js → chunk-GX24H4PF.js} +0 -0
@@ -1,29 +1,46 @@
1
-
2
- > @synap-core/types@0.1.0 build /Users/antoine/Documents/Code/synap/synap-backend/packages/types
3
- > tsup
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/realtime/index.ts, src/users/index.ts, src/views/index.ts, src/workspaces/index.ts
6
- CLI Using tsconfig: tsconfig.json
7
- CLI tsup v8.5.1
8
- CLI Using tsup config: /Users/antoine/Documents/Code/synap/synap-backend/packages/types/tsup.config.ts
9
- CLI Target: es2022
10
- CLI Cleaning output folder
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
- ESM dist/chunk-X5L3VJJZ.js 0 B
16
- 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
- ESM dist/workspaces/index.js 31.00 B
21
- ESM dist/entities/index.js 340.00 B
22
- ESM dist/chunk-OPLFDITK.js 2.37 KB
23
- ESM dist/realtime/index.js 31.00 B
24
- ESM dist/views/index.js 31.00 B
25
- ESM dist/users/index.js 31.00 B
26
- ESM dist/preferences/index.js 31.00 B
27
- ESM dist/chunk-ZFFMXKF2.js 1.15 KB
28
- ESM dist/inbox/index.js 210.00 B
29
- ESM ⚡️ Build success in 226ms
1
+
2
+ 
3
+ > @synap-core/types@0.3.6 build /Users/antoine/Documents/Code/synap/synap-backend/packages/types
4
+ > tsup
5
+
6
+ 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/realtime/index.ts, src/relations/index.ts, src/users/index.ts, src/views/index.ts, src/workspaces/index.ts
7
+ CLI Using tsconfig: tsconfig.json
8
+ CLI tsup v8.5.1
9
+ CLI Using tsup config: /Users/antoine/Documents/Code/synap/synap-backend/packages/types/tsup.config.ts
10
+ CLI Target: es2022
11
+ CLI Cleaning output folder
12
+ ESM Build start
13
+ ESM dist/chunk-2N5ZC5EB.js 0 B
14
+ ESM dist/chunk-IZA3UKBT.js 0 B
15
+ ESM dist/chunk-7LKCNZXD.js 0 B
16
+ ESM dist/chunk-GX24H4PF.js 0 B
17
+ ESM dist/chunk-QAWJ6GM3.js 0 B
18
+ ESM dist/users/index.js 31.00 B
19
+ ESM dist/workspaces/index.js 31.00 B
20
+ ESM dist/views/index.js 642.00 B
21
+ ESM dist/chunk-5MS6TR4O.js 3.86 KB
22
+ ESM dist/chunk-X5L3VJJZ.js 0 B
23
+ ESM dist/index.js 14.87 KB
24
+ ESM dist/documents/index.js 31.00 B
25
+ ESM dist/entities/index.js 372.00 B
26
+ ESM dist/chunk-44W6WKWP.js 3.60 KB
27
+ ESM dist/events/index.js 405.00 B
28
+ ESM dist/inbox/index.js 31.00 B
29
+ ESM dist/preferences/index.js 470.00 B
30
+ ESM dist/chunk-GI5BUXJF.js 3.25 KB
31
+ ESM dist/realtime/index.js 31.00 B
32
+ ESM dist/relations/index.js 31.00 B
33
+ ESM ⚡️ Build success in 13ms
34
+ DTS Build start
35
+ src/views/index.ts(20,1): error TS2308: Module './types.js' has already exported a member named 'EntityFilter'. Consider explicitly re-exporting to resolve the ambiguity.
36
+ src/views/index.ts(20,1): error TS2308: Module './types.js' has already exported a member named 'EntityQuery'. Consider explicitly re-exporting to resolve the ambiguity.
37
+ src/views/index.ts(21,1): error TS2308: Module './types.js' has already exported a member named 'StructuredViewConfig'. Consider explicitly re-exporting to resolve the ambiguity.
38
+
39
+ Error: error occurred in dts build
40
+ at Worker.<anonymous> (/Users/antoine/Documents/Code/synap/synap-backend/node_modules/.pnpm/tsup@8.5.1_tsx@4.21.0_typescript@5.9.3/node_modules/tsup/dist/index.js:1545:26)
41
+ at Worker.emit (node:events:520:28)
42
+ at MessagePort.<anonymous> (node:internal/worker:262:53)
43
+ at [nodejs.internal.kHybridDispatch] (node:internal/event_target:816:20)
44
+ at MessagePort.<anonymous> (node:internal/per_context/messageport:23:28)
45
+ DTS Build error
46
+  ELIFECYCLE  Command failed with exit code 1.
@@ -42,6 +42,19 @@ var ENTITY_SCHEMAS = {
42
42
  extension: z.string(),
43
43
  thumbnailUrl: z.string().url().optional(),
44
44
  downloadUrl: z.string().url().optional()
45
+ }),
46
+ code: z.object({
47
+ language: z.string(),
48
+ snippet: z.string().optional()
49
+ }),
50
+ bookmark: z.object({
51
+ url: z.string().url(),
52
+ favicon: z.string().optional()
53
+ }),
54
+ company: z.object({
55
+ website: z.string().url().optional(),
56
+ industry: z.string().optional(),
57
+ foundedYear: z.number().int().optional()
45
58
  })
46
59
  };
47
60
  function validateEntityMetadata(type, metadata) {
@@ -51,6 +64,25 @@ function safeValidateEntityMetadata(type, metadata) {
51
64
  return ENTITY_SCHEMAS[type].safeParse(metadata);
52
65
  }
53
66
 
67
+ // src/entities/types.ts
68
+ import { z as z2 } from "zod";
69
+ import { selectEntitySchema } from "@synap/database/schema";
70
+ var CompanyPropertiesSchema = z2.object({
71
+ website: z2.string().optional(),
72
+ industry: z2.string().optional(),
73
+ foundedYear: z2.number().optional()
74
+ }).partial();
75
+ var EntitySchema = z2.discriminatedUnion("type", [
76
+ selectEntitySchema.extend({ type: z2.literal("task"), metadata: ENTITY_SCHEMAS.task }),
77
+ selectEntitySchema.extend({ type: z2.literal("note"), metadata: ENTITY_SCHEMAS.note }),
78
+ selectEntitySchema.extend({ type: z2.literal("person"), metadata: ENTITY_SCHEMAS.person }),
79
+ selectEntitySchema.extend({ type: z2.literal("event"), metadata: ENTITY_SCHEMAS.event }),
80
+ selectEntitySchema.extend({ type: z2.literal("file"), metadata: ENTITY_SCHEMAS.file }),
81
+ selectEntitySchema.extend({ type: z2.literal("code"), metadata: ENTITY_SCHEMAS.code }),
82
+ selectEntitySchema.extend({ type: z2.literal("bookmark"), metadata: ENTITY_SCHEMAS.bookmark }),
83
+ selectEntitySchema.extend({ type: z2.literal("company"), metadata: ENTITY_SCHEMAS.company })
84
+ ]);
85
+
54
86
  // src/entities/guards.ts
55
87
  function isTask(entity) {
56
88
  return entity.type === "task";
@@ -75,6 +107,8 @@ export {
75
107
  ENTITY_SCHEMAS,
76
108
  validateEntityMetadata,
77
109
  safeValidateEntityMetadata,
110
+ CompanyPropertiesSchema,
111
+ EntitySchema,
78
112
  isTask,
79
113
  isNote,
80
114
  isPerson,
@@ -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
+ };
File without changes
File without changes
@@ -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
+ };
File without changes
@@ -1 +1,20 @@
1
- import "../chunk-7LKCNZXD.js";
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
+ };
@@ -1,5 +1,7 @@
1
1
  import {
2
+ CompanyPropertiesSchema,
2
3
  ENTITY_SCHEMAS,
4
+ EntitySchema,
3
5
  isEntityOfType,
4
6
  isEvent,
5
7
  isFile,
@@ -8,9 +10,11 @@ import {
8
10
  isTask,
9
11
  safeValidateEntityMetadata,
10
12
  validateEntityMetadata
11
- } from "../chunk-OPLFDITK.js";
13
+ } from "../chunk-27HQLZOR.js";
12
14
  export {
15
+ CompanyPropertiesSchema,
13
16
  ENTITY_SCHEMAS,
17
+ EntitySchema,
14
18
  isEntityOfType,
15
19
  isEvent,
16
20
  isFile,
@@ -1,12 +1 @@
1
- import {
2
- INBOX_SCHEMAS,
3
- isCalendarInboxItem,
4
- isEmailInboxItem,
5
- isSlackInboxItem
6
- } from "../chunk-ZFFMXKF2.js";
7
- export {
8
- INBOX_SCHEMAS,
9
- isCalendarInboxItem,
10
- isEmailInboxItem,
11
- isSlackInboxItem
12
- };
1
+ import "../chunk-GX24H4PF.js";