@synap-core/client 0.1.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.
@@ -0,0 +1,1348 @@
1
+ /**
2
+ * @synap/client - Type-safe Client SDK for Synap
3
+ *
4
+ * Direct tRPC client export with full type safety.
5
+ * Auto-syncs with API changes via AppRouter type.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import { createSynapClient } from '@synap/client';
10
+ *
11
+ * const client = createSynapClient({
12
+ * url: 'https://api.synap.app',
13
+ * headers: () => ({
14
+ * Authorization: `Bearer ${token}`,
15
+ * }),
16
+ * });
17
+ *
18
+ * // Fully typed API calls
19
+ * const entities = await client.entities.list.query({ limit: 20 });
20
+ * const tag = await client.tags.create.mutate({ name: 'Important' });
21
+ * ```
22
+ */
23
+ /**
24
+ * Configuration for Synap client
25
+ */
26
+ export interface SynapClientConfig {
27
+ /**
28
+ * Base URL for the Synap API
29
+ * @example 'https://api.synap.app' or 'http://localhost:3000'
30
+ */
31
+ url: string;
32
+ /**
33
+ * Optional headers to include with every request
34
+ * Can be a function for dynamic headers (e.g., authentication tokens)
35
+ */
36
+ headers?: Record<string, string> | (() => Record<string, string> | Promise<Record<string, string>>);
37
+ /**
38
+ * Optional fetch implementation
39
+ * Useful for React Native or custom fetch behavior
40
+ */
41
+ fetch?: typeof globalThis.fetch;
42
+ }
43
+ /**
44
+ * Create a type-safe Synap API client
45
+ *
46
+ * This client auto-syncs with the API's AppRouter type,
47
+ * providing full autocomplete and type safety for all routes.
48
+ *
49
+ * @param config - Client configuration
50
+ * @returns Fully typed tRPC client
51
+ *
52
+ * @example
53
+ * ```typescript
54
+ * // Basic usage
55
+ * const client = createSynapClient({
56
+ * url: 'https://api.synap.app',
57
+ * });
58
+ *
59
+ * // With authentication
60
+ * const client = createSynapClient({
61
+ * url: 'https://api.synap.app',
62
+ * headers: {
63
+ * Authorization: `Bearer ${token}`,
64
+ * },
65
+ * });
66
+ *
67
+ * // With dynamic headers
68
+ * const client = createSynapClient({
69
+ * url: 'https://api.synap.app',
70
+ * headers: async () => ({
71
+ * Authorization: `Bearer ${await getToken()}`,
72
+ * }),
73
+ * });
74
+ * ```
75
+ */
76
+ export declare function createSynapClient(config: SynapClientConfig): import("@trpc/client").TRPCClient<import("@trpc/server").TRPCBuiltRouter<{
77
+ ctx: import("@synap/api").Context;
78
+ meta: object;
79
+ errorShape: import("@trpc/server").TRPCDefaultErrorShape;
80
+ transformer: false;
81
+ }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
82
+ events: import("@trpc/server").TRPCBuiltRouter<{
83
+ ctx: import("@synap/api").Context;
84
+ meta: object;
85
+ errorShape: import("@trpc/server").TRPCDefaultErrorShape;
86
+ transformer: false;
87
+ }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
88
+ log: import("@trpc/server").TRPCMutationProcedure<{
89
+ input: {
90
+ eventType: string;
91
+ version: number;
92
+ data: Record<string, unknown>;
93
+ aggregateId: string;
94
+ aggregateType: "user" | "entity" | "relation" | "system";
95
+ source?: "system" | "api" | "automation" | "sync" | "migration" | undefined;
96
+ metadata?: Record<string, unknown> | undefined;
97
+ causationId?: string | undefined;
98
+ correlationId?: string | undefined;
99
+ };
100
+ output: import("@synap/database").EventRecord;
101
+ meta: object;
102
+ }>;
103
+ list: import("@trpc/server").TRPCQueryProcedure<{
104
+ input: {
105
+ type?: string | undefined;
106
+ limit?: number | undefined;
107
+ };
108
+ output: import("@synap/database").EventRecord[];
109
+ meta: object;
110
+ }>;
111
+ }>>;
112
+ capture: import("@trpc/server").TRPCBuiltRouter<{
113
+ ctx: import("@synap/api").Context;
114
+ meta: object;
115
+ errorShape: import("@trpc/server").TRPCDefaultErrorShape;
116
+ transformer: false;
117
+ }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
118
+ thought: import("@trpc/server").TRPCMutationProcedure<{
119
+ input: {
120
+ content: string;
121
+ context?: Record<string, any> | undefined;
122
+ };
123
+ output: {
124
+ success: boolean;
125
+ message: string;
126
+ requestId: string;
127
+ mode: string;
128
+ } | {
129
+ success: boolean;
130
+ message: string;
131
+ mode: string;
132
+ requestId?: undefined;
133
+ };
134
+ meta: object;
135
+ }>;
136
+ }>>;
137
+ entities: import("@trpc/server").TRPCBuiltRouter<{
138
+ ctx: import("@synap/api").Context;
139
+ meta: object;
140
+ errorShape: import("@trpc/server").TRPCDefaultErrorShape;
141
+ transformer: false;
142
+ }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
143
+ create: import("@trpc/server").TRPCMutationProcedure<{
144
+ input: {
145
+ type: "note" | "task" | "project" | "contact" | "meeting" | "idea";
146
+ title: string;
147
+ description?: string | undefined;
148
+ fileUrl?: string | undefined;
149
+ filePath?: string | undefined;
150
+ fileSize?: number | undefined;
151
+ fileType?: string | undefined;
152
+ };
153
+ output: {
154
+ entity: {
155
+ userId: string;
156
+ version: number;
157
+ metadata: unknown;
158
+ id: string;
159
+ type: string;
160
+ title: string | null;
161
+ preview: string | null;
162
+ documentId: string | null;
163
+ fileUrl: string | null;
164
+ filePath: string | null;
165
+ fileSize: number | null;
166
+ fileType: string | null;
167
+ checksum: string | null;
168
+ createdAt: Date;
169
+ updatedAt: Date;
170
+ deletedAt: Date | null;
171
+ };
172
+ };
173
+ meta: object;
174
+ }>;
175
+ list: import("@trpc/server").TRPCQueryProcedure<{
176
+ input: {
177
+ type?: "note" | "task" | "project" | "contact" | "meeting" | "idea" | undefined;
178
+ limit?: number | undefined;
179
+ };
180
+ output: {
181
+ entities: {
182
+ userId: string;
183
+ version: number;
184
+ metadata: unknown;
185
+ id: string;
186
+ type: string;
187
+ title: string | null;
188
+ preview: string | null;
189
+ documentId: string | null;
190
+ fileUrl: string | null;
191
+ filePath: string | null;
192
+ fileSize: number | null;
193
+ fileType: string | null;
194
+ checksum: string | null;
195
+ createdAt: Date;
196
+ updatedAt: Date;
197
+ deletedAt: Date | null;
198
+ }[];
199
+ };
200
+ meta: object;
201
+ }>;
202
+ search: import("@trpc/server").TRPCQueryProcedure<{
203
+ input: {
204
+ query: string;
205
+ type?: "note" | "task" | "project" | "contact" | "meeting" | "idea" | undefined;
206
+ limit?: number | undefined;
207
+ };
208
+ output: {
209
+ entities: {
210
+ userId: string;
211
+ version: number;
212
+ metadata: unknown;
213
+ id: string;
214
+ type: string;
215
+ title: string | null;
216
+ preview: string | null;
217
+ documentId: string | null;
218
+ fileUrl: string | null;
219
+ filePath: string | null;
220
+ fileSize: number | null;
221
+ fileType: string | null;
222
+ checksum: string | null;
223
+ createdAt: Date;
224
+ updatedAt: Date;
225
+ deletedAt: Date | null;
226
+ }[];
227
+ };
228
+ meta: object;
229
+ }>;
230
+ get: import("@trpc/server").TRPCQueryProcedure<{
231
+ input: {
232
+ id: string;
233
+ };
234
+ output: {
235
+ entity: {
236
+ userId: string;
237
+ version: number;
238
+ metadata: unknown;
239
+ id: string;
240
+ type: string;
241
+ title: string | null;
242
+ preview: string | null;
243
+ documentId: string | null;
244
+ fileUrl: string | null;
245
+ filePath: string | null;
246
+ fileSize: number | null;
247
+ fileType: string | null;
248
+ checksum: string | null;
249
+ createdAt: Date;
250
+ updatedAt: Date;
251
+ deletedAt: Date | null;
252
+ };
253
+ };
254
+ meta: object;
255
+ }>;
256
+ update: import("@trpc/server").TRPCMutationProcedure<{
257
+ input: {
258
+ id: string;
259
+ description?: string | undefined;
260
+ title?: string | undefined;
261
+ };
262
+ output: {
263
+ entity: {
264
+ userId: string;
265
+ version: number;
266
+ metadata: unknown;
267
+ id: string;
268
+ type: string;
269
+ title: string | null;
270
+ preview: string | null;
271
+ documentId: string | null;
272
+ fileUrl: string | null;
273
+ filePath: string | null;
274
+ fileSize: number | null;
275
+ fileType: string | null;
276
+ checksum: string | null;
277
+ createdAt: Date;
278
+ updatedAt: Date;
279
+ deletedAt: Date | null;
280
+ };
281
+ };
282
+ meta: object;
283
+ }>;
284
+ delete: import("@trpc/server").TRPCMutationProcedure<{
285
+ input: {
286
+ id: string;
287
+ };
288
+ output: {
289
+ success: boolean;
290
+ };
291
+ meta: object;
292
+ }>;
293
+ }>>;
294
+ notes: import("@trpc/server").TRPCBuiltRouter<{
295
+ ctx: import("@synap/api").Context;
296
+ meta: object;
297
+ errorShape: import("@trpc/server").TRPCDefaultErrorShape;
298
+ transformer: false;
299
+ }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
300
+ create: import("@trpc/server").TRPCMutationProcedure<{
301
+ input: {
302
+ content: string;
303
+ tags?: string[] | undefined;
304
+ title?: string | undefined;
305
+ };
306
+ output: {
307
+ success: boolean;
308
+ status: "pending";
309
+ requestId: `${string}-${string}-${string}-${string}-${string}`;
310
+ entityId: `${string}-${string}-${string}-${string}-${string}`;
311
+ message: string;
312
+ };
313
+ meta: object;
314
+ }>;
315
+ list: import("@trpc/server").TRPCQueryProcedure<{
316
+ input: {
317
+ type?: "note" | "task" | "all" | undefined;
318
+ limit?: number | undefined;
319
+ offset?: number | undefined;
320
+ };
321
+ output: {
322
+ notes: {
323
+ id: any;
324
+ title: any;
325
+ preview: any;
326
+ type: any;
327
+ fileUrl: any;
328
+ filePath: any;
329
+ fileSize: any;
330
+ fileType: any;
331
+ createdAt: any;
332
+ updatedAt: any;
333
+ }[];
334
+ total: number;
335
+ limit: number;
336
+ offset: number;
337
+ };
338
+ meta: object;
339
+ }>;
340
+ getById: import("@trpc/server").TRPCQueryProcedure<{
341
+ input: {
342
+ id: string;
343
+ };
344
+ output: {
345
+ id: any;
346
+ title: any;
347
+ preview: any;
348
+ type: any;
349
+ fileUrl: any;
350
+ filePath: any;
351
+ fileSize: any;
352
+ fileType: any;
353
+ checksum: any;
354
+ createdAt: any;
355
+ updatedAt: any;
356
+ } | null;
357
+ meta: object;
358
+ }>;
359
+ }>>;
360
+ chat: import("@trpc/server").TRPCBuiltRouter<{
361
+ ctx: import("@synap/api").Context;
362
+ meta: object;
363
+ errorShape: import("@trpc/server").TRPCDefaultErrorShape;
364
+ transformer: false;
365
+ }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{}>>;
366
+ suggestions: import("@trpc/server").TRPCBuiltRouter<{
367
+ ctx: import("@synap/api").Context;
368
+ meta: object;
369
+ errorShape: import("@trpc/server").TRPCDefaultErrorShape;
370
+ transformer: false;
371
+ }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{}>>;
372
+ system: import("@trpc/server").TRPCBuiltRouter<{
373
+ ctx: import("@synap/api").Context;
374
+ meta: object;
375
+ errorShape: import("@trpc/server").TRPCDefaultErrorShape;
376
+ transformer: false;
377
+ }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
378
+ getCapabilities: import("@trpc/server").TRPCQueryProcedure<{
379
+ input: void;
380
+ output: {
381
+ eventTypes: ({
382
+ type: import("@synap/events").GeneratedEventType;
383
+ hasSchema: boolean;
384
+ category: "generated";
385
+ table: string | undefined;
386
+ action: import("@synap/events").TableAction | undefined;
387
+ } | {
388
+ type: "webhooks.deliver.requested";
389
+ hasSchema: boolean;
390
+ category: "custom";
391
+ })[];
392
+ workers: import("@synap/jobs").WorkerMetadata[];
393
+ tools: {
394
+ name: string;
395
+ description: string | undefined;
396
+ version: string;
397
+ source: string;
398
+ }[];
399
+ routers: {
400
+ name: string;
401
+ version: string;
402
+ source: string;
403
+ description: string | undefined;
404
+ }[];
405
+ stats: {
406
+ totalEventTypes: number;
407
+ totalHandlers: number;
408
+ totalTools: number;
409
+ totalRouters: number;
410
+ connectedSSEClients: number;
411
+ toolsBySource: Record<string, number>;
412
+ routersBySource: Record<string, number>;
413
+ };
414
+ };
415
+ meta: object;
416
+ }>;
417
+ getEventTypeSchema: import("@trpc/server").TRPCQueryProcedure<{
418
+ input: {
419
+ eventType: string;
420
+ };
421
+ output: {
422
+ hasSchema: boolean;
423
+ fields: null;
424
+ } | {
425
+ hasSchema: boolean;
426
+ fields: {
427
+ name: string;
428
+ type: string;
429
+ required: boolean;
430
+ description?: string;
431
+ options?: string[];
432
+ defaultValue?: unknown;
433
+ }[];
434
+ };
435
+ meta: object;
436
+ }>;
437
+ publishEvent: import("@trpc/server").TRPCMutationProcedure<{
438
+ input: {
439
+ userId: string;
440
+ data: Record<string, unknown>;
441
+ type: string;
442
+ source?: "system" | "api" | "automation" | "sync" | "migration" | undefined;
443
+ aggregateId?: string | undefined;
444
+ causationId?: string | undefined;
445
+ correlationId?: string | undefined;
446
+ };
447
+ output: {
448
+ success: boolean;
449
+ eventId: string;
450
+ timestamp: string;
451
+ message: string;
452
+ };
453
+ meta: object;
454
+ }>;
455
+ getRecentEvents: import("@trpc/server").TRPCQueryProcedure<{
456
+ input: {
457
+ userId?: string | undefined;
458
+ eventType?: string | undefined;
459
+ limit?: number | undefined;
460
+ since?: string | undefined;
461
+ };
462
+ output: {
463
+ events: {
464
+ id: string;
465
+ type: string;
466
+ userId: string;
467
+ timestamp: string;
468
+ correlationId: string | undefined;
469
+ isError: boolean;
470
+ }[];
471
+ total: number;
472
+ timestamp: string;
473
+ };
474
+ meta: object;
475
+ }>;
476
+ getTrace: import("@trpc/server").TRPCQueryProcedure<{
477
+ input: {
478
+ correlationId: string;
479
+ };
480
+ output: {
481
+ correlationId: string;
482
+ events: {
483
+ id: string;
484
+ type: string;
485
+ timestamp: string;
486
+ userId: string;
487
+ aggregateId: string;
488
+ data: Record<string, unknown>;
489
+ metadata: Record<string, unknown> | undefined;
490
+ causationId: string | undefined;
491
+ }[];
492
+ totalEvents: number;
493
+ };
494
+ meta: object;
495
+ }>;
496
+ getEventTrace: import("@trpc/server").TRPCQueryProcedure<{
497
+ input: {
498
+ eventId: string;
499
+ };
500
+ output: {
501
+ event: {
502
+ eventId: string;
503
+ eventType: string;
504
+ timestamp: string;
505
+ userId: string;
506
+ data: Record<string, unknown>;
507
+ metadata: Record<string, unknown> | undefined;
508
+ correlationId: string | undefined;
509
+ };
510
+ relatedEvents: {
511
+ eventId: string;
512
+ eventType: string;
513
+ timestamp: string;
514
+ userId: string;
515
+ data: Record<string, unknown>;
516
+ correlationId: string | undefined;
517
+ }[];
518
+ };
519
+ meta: object;
520
+ }>;
521
+ searchEvents: import("@trpc/server").TRPCQueryProcedure<{
522
+ input: {
523
+ userId?: string | undefined;
524
+ eventType?: string | undefined;
525
+ aggregateId?: string | undefined;
526
+ aggregateType?: string | undefined;
527
+ correlationId?: string | undefined;
528
+ limit?: number | undefined;
529
+ fromDate?: string | undefined;
530
+ toDate?: string | undefined;
531
+ offset?: number | undefined;
532
+ };
533
+ output: {
534
+ events: {
535
+ id: string;
536
+ type: string;
537
+ timestamp: string;
538
+ userId: string;
539
+ aggregateId: string;
540
+ aggregateType: string;
541
+ data: Record<string, unknown>;
542
+ metadata: Record<string, unknown> | undefined;
543
+ causationId: string | undefined;
544
+ correlationId: string | undefined;
545
+ source: string;
546
+ }[];
547
+ pagination: {
548
+ total: number;
549
+ limit: number;
550
+ offset: number;
551
+ hasMore: boolean;
552
+ };
553
+ };
554
+ meta: object;
555
+ }>;
556
+ getToolSchema: import("@trpc/server").TRPCQueryProcedure<{
557
+ input: {
558
+ toolName: string;
559
+ };
560
+ output: {
561
+ name: string;
562
+ description: string;
563
+ schema: {
564
+ type: string;
565
+ properties: any;
566
+ required: string[];
567
+ };
568
+ metadata: {
569
+ version: string;
570
+ source: string;
571
+ registeredAt: string | undefined;
572
+ };
573
+ };
574
+ meta: object;
575
+ }>;
576
+ executeTool: import("@trpc/server").TRPCMutationProcedure<{
577
+ input: {
578
+ userId: string;
579
+ toolName: string;
580
+ parameters: Record<string, any>;
581
+ threadId?: string | undefined;
582
+ };
583
+ output: {
584
+ success: boolean;
585
+ result: {
586
+ result: any;
587
+ };
588
+ toolName: string;
589
+ executedAt: string;
590
+ };
591
+ meta: object;
592
+ }>;
593
+ getDashboardMetrics: import("@trpc/server").TRPCQueryProcedure<{
594
+ input: void;
595
+ output: {
596
+ timestamp: string;
597
+ health: {
598
+ status: "healthy" | "degraded" | "critical";
599
+ errorRate: number;
600
+ };
601
+ throughput: {
602
+ eventsPerSecond: number;
603
+ totalEventsLast5Min: number;
604
+ };
605
+ connections: {
606
+ activeSSEClients: number;
607
+ activeHandlers: number;
608
+ };
609
+ tools: {
610
+ totalTools: number;
611
+ totalExecutions: number;
612
+ };
613
+ latestEvents: {
614
+ id: string;
615
+ type: string;
616
+ userId: string;
617
+ timestamp: string;
618
+ isError: boolean;
619
+ }[];
620
+ };
621
+ meta: object;
622
+ }>;
623
+ getDatabaseTables: import("@trpc/server").TRPCQueryProcedure<{
624
+ input: void;
625
+ output: Record<string, unknown>[];
626
+ meta: object;
627
+ }>;
628
+ getDatabaseTableRows: import("@trpc/server").TRPCQueryProcedure<{
629
+ input: {
630
+ tableName: string;
631
+ limit?: number | undefined;
632
+ offset?: number | undefined;
633
+ };
634
+ output: import("postgres").RowList<Record<string, unknown>[]>;
635
+ meta: object;
636
+ }>;
637
+ }>>;
638
+ hub: import("@trpc/server").TRPCBuiltRouter<{
639
+ ctx: import("@synap/api").Context;
640
+ meta: object;
641
+ errorShape: import("@trpc/server").TRPCDefaultErrorShape;
642
+ transformer: false;
643
+ }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
644
+ generateAccessToken: import("@trpc/server").TRPCMutationProcedure<{
645
+ input: {
646
+ requestId: string;
647
+ scope: ("entities" | "preferences" | "calendar" | "notes" | "tasks" | "projects" | "conversations" | "relations" | "knowledge_facts")[];
648
+ expiresIn?: number | undefined;
649
+ };
650
+ output: {
651
+ token: string;
652
+ expiresAt: number;
653
+ requestId: string;
654
+ };
655
+ meta: object;
656
+ }>;
657
+ requestData: import("@trpc/server").TRPCQueryProcedure<{
658
+ input: {
659
+ scope: ("entities" | "preferences" | "calendar" | "notes" | "tasks" | "projects" | "conversations" | "relations" | "knowledge_facts")[];
660
+ token: string;
661
+ filters?: {
662
+ limit?: number | undefined;
663
+ offset?: number | undefined;
664
+ dateRange?: {
665
+ start: string;
666
+ end: string;
667
+ } | undefined;
668
+ entityTypes?: string[] | undefined;
669
+ } | undefined;
670
+ };
671
+ output: {
672
+ userId: string;
673
+ requestId: string;
674
+ data: Record<string, unknown>;
675
+ metadata: {
676
+ retrievedAt: string;
677
+ scope: ("entities" | "preferences" | "calendar" | "notes" | "tasks" | "projects" | "conversations" | "relations" | "knowledge_facts")[];
678
+ recordCount: number;
679
+ };
680
+ };
681
+ meta: object;
682
+ }>;
683
+ submitInsight: import("@trpc/server").TRPCMutationProcedure<{
684
+ input: {
685
+ token: string;
686
+ insight?: any;
687
+ };
688
+ output: {
689
+ success: boolean;
690
+ requestId: string;
691
+ eventIds: string[];
692
+ eventsCreated: number;
693
+ errors: {
694
+ actionIndex: number;
695
+ error: string;
696
+ }[] | undefined;
697
+ };
698
+ meta: object;
699
+ }>;
700
+ }>>;
701
+ apiKeys: import("@trpc/server").TRPCBuiltRouter<{
702
+ ctx: import("@synap/api").Context;
703
+ meta: object;
704
+ errorShape: import("@trpc/server").TRPCDefaultErrorShape;
705
+ transformer: false;
706
+ }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
707
+ create: import("@trpc/server").TRPCMutationProcedure<{
708
+ input: {
709
+ scope: string[];
710
+ keyName: string;
711
+ hubId?: string | undefined;
712
+ expiresInDays?: number | undefined;
713
+ };
714
+ output: {
715
+ success: boolean;
716
+ key: string;
717
+ keyId: string;
718
+ message: string;
719
+ };
720
+ meta: object;
721
+ }>;
722
+ list: import("@trpc/server").TRPCQueryProcedure<{
723
+ input: void;
724
+ output: {
725
+ id: string;
726
+ keyName: string;
727
+ keyPrefix: string;
728
+ hubId: string | null;
729
+ scope: string[];
730
+ isActive: boolean;
731
+ expiresAt: Date | null;
732
+ lastUsedAt: Date | null;
733
+ usageCount: number;
734
+ rotationScheduledAt: Date | null;
735
+ createdAt: Date;
736
+ revokedAt: Date | null;
737
+ revokedReason: string | null;
738
+ }[];
739
+ meta: object;
740
+ }>;
741
+ revoke: import("@trpc/server").TRPCMutationProcedure<{
742
+ input: {
743
+ keyId: string;
744
+ reason?: string | undefined;
745
+ };
746
+ output: {
747
+ success: boolean;
748
+ message: string;
749
+ };
750
+ meta: object;
751
+ }>;
752
+ rotate: import("@trpc/server").TRPCMutationProcedure<{
753
+ input: {
754
+ keyId: string;
755
+ };
756
+ output: {
757
+ success: boolean;
758
+ newKey: string;
759
+ newKeyId: string;
760
+ message: string;
761
+ };
762
+ meta: object;
763
+ }>;
764
+ }>>;
765
+ health: import("@trpc/server").TRPCBuiltRouter<{
766
+ ctx: import("@synap/api").Context;
767
+ meta: object;
768
+ errorShape: import("@trpc/server").TRPCDefaultErrorShape;
769
+ transformer: false;
770
+ }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
771
+ alive: import("@trpc/server").TRPCQueryProcedure<{
772
+ input: void;
773
+ output: {
774
+ status: string;
775
+ timestamp: string;
776
+ };
777
+ meta: object;
778
+ }>;
779
+ ready: import("@trpc/server").TRPCQueryProcedure<{
780
+ input: void;
781
+ output: {
782
+ status: string;
783
+ timestamp: string;
784
+ checks: {
785
+ database: string;
786
+ inngest: string;
787
+ };
788
+ details: {
789
+ database: any;
790
+ inngest: any;
791
+ };
792
+ };
793
+ meta: object;
794
+ }>;
795
+ migrations: import("@trpc/server").TRPCQueryProcedure<{
796
+ input: void;
797
+ output: {
798
+ total: number;
799
+ migrations: {
800
+ version: string;
801
+ appliedAt: string;
802
+ description: string;
803
+ }[];
804
+ note: string;
805
+ };
806
+ meta: object;
807
+ }>;
808
+ metrics: import("@trpc/server").TRPCQueryProcedure<{
809
+ input: void;
810
+ output: {
811
+ timestamp: string;
812
+ uptime: number;
813
+ memory: {
814
+ used: number;
815
+ total: number;
816
+ rss: number;
817
+ };
818
+ events24h: number;
819
+ totalEntities: number;
820
+ };
821
+ meta: object;
822
+ }>;
823
+ }>>;
824
+ webhooks: import("@trpc/server").TRPCBuiltRouter<{
825
+ ctx: import("@synap/api").Context;
826
+ meta: object;
827
+ errorShape: import("@trpc/server").TRPCDefaultErrorShape;
828
+ transformer: false;
829
+ }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
830
+ create: import("@trpc/server").TRPCMutationProcedure<{
831
+ input: {
832
+ url: string;
833
+ name: string;
834
+ eventTypes: string[];
835
+ secret?: string | undefined;
836
+ };
837
+ output: {
838
+ subscription: {
839
+ userId: string;
840
+ url: string;
841
+ name: string;
842
+ id: string;
843
+ eventTypes: string[];
844
+ createdAt: Date;
845
+ active: boolean;
846
+ secret: string;
847
+ retryConfig: unknown;
848
+ lastTriggeredAt: Date | null;
849
+ };
850
+ secret: string;
851
+ };
852
+ meta: object;
853
+ }>;
854
+ list: import("@trpc/server").TRPCQueryProcedure<{
855
+ input: void;
856
+ output: {
857
+ userId: string;
858
+ url: string;
859
+ name: string;
860
+ id: string;
861
+ eventTypes: string[];
862
+ createdAt: Date;
863
+ active: boolean;
864
+ retryConfig: unknown;
865
+ lastTriggeredAt: Date | null;
866
+ }[];
867
+ meta: object;
868
+ }>;
869
+ update: import("@trpc/server").TRPCMutationProcedure<{
870
+ input: {
871
+ id: string;
872
+ url?: string | undefined;
873
+ name?: string | undefined;
874
+ eventTypes?: string[] | undefined;
875
+ active?: boolean | undefined;
876
+ };
877
+ output: {
878
+ userId: string;
879
+ url: string;
880
+ name: string;
881
+ id: string;
882
+ eventTypes: string[];
883
+ createdAt: Date;
884
+ active: boolean;
885
+ retryConfig: unknown;
886
+ lastTriggeredAt: Date | null;
887
+ };
888
+ meta: object;
889
+ }>;
890
+ delete: import("@trpc/server").TRPCMutationProcedure<{
891
+ input: {
892
+ id: string;
893
+ };
894
+ output: {
895
+ success: boolean;
896
+ };
897
+ meta: object;
898
+ }>;
899
+ }>>;
900
+ documents: import("@trpc/server").TRPCBuiltRouter<{
901
+ ctx: import("@synap/api").Context;
902
+ meta: object;
903
+ errorShape: import("@trpc/server").TRPCDefaultErrorShape;
904
+ transformer: false;
905
+ }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
906
+ upload: import("@trpc/server").TRPCMutationProcedure<{
907
+ input: {
908
+ type: "code" | "text" | "markdown" | "pdf" | "docx";
909
+ content: string;
910
+ title: string;
911
+ language?: string | undefined;
912
+ mimeType?: string | undefined;
913
+ projectId?: string | undefined;
914
+ };
915
+ output: {
916
+ documentId: string;
917
+ storageUrl: string;
918
+ version: number;
919
+ };
920
+ meta: object;
921
+ }>;
922
+ get: import("@trpc/server").TRPCQueryProcedure<{
923
+ input: {
924
+ documentId: string;
925
+ };
926
+ output: {
927
+ document: {
928
+ userId: string;
929
+ metadata: unknown;
930
+ id: string;
931
+ type: string;
932
+ title: string;
933
+ createdAt: Date;
934
+ updatedAt: Date;
935
+ deletedAt: Date | null;
936
+ language: string | null;
937
+ storageUrl: string;
938
+ storageKey: string;
939
+ size: number;
940
+ mimeType: string | null;
941
+ currentVersion: number;
942
+ projectId: string | null;
943
+ };
944
+ content: string;
945
+ };
946
+ meta: object;
947
+ }>;
948
+ update: import("@trpc/server").TRPCMutationProcedure<{
949
+ input: {
950
+ version: number;
951
+ documentId: string;
952
+ delta: {
953
+ content: string;
954
+ }[];
955
+ message?: string | undefined;
956
+ };
957
+ output: {
958
+ version: number;
959
+ success: boolean;
960
+ };
961
+ meta: object;
962
+ }>;
963
+ startSession: import("@trpc/server").TRPCMutationProcedure<{
964
+ input: {
965
+ documentId: string;
966
+ };
967
+ output: {
968
+ sessionId: string;
969
+ chatThreadId: `${string}-${string}-${string}-${string}-${string}`;
970
+ };
971
+ meta: object;
972
+ }>;
973
+ list: import("@trpc/server").TRPCQueryProcedure<{
974
+ input: {
975
+ type?: "code" | "text" | "markdown" | "pdf" | "docx" | undefined;
976
+ limit?: number | undefined;
977
+ projectId?: string | undefined;
978
+ };
979
+ output: {
980
+ documents: {
981
+ userId: string;
982
+ metadata: unknown;
983
+ id: string;
984
+ type: string;
985
+ title: string;
986
+ createdAt: Date;
987
+ updatedAt: Date;
988
+ deletedAt: Date | null;
989
+ language: string | null;
990
+ storageUrl: string;
991
+ storageKey: string;
992
+ size: number;
993
+ mimeType: string | null;
994
+ currentVersion: number;
995
+ projectId: string | null;
996
+ }[];
997
+ total: number;
998
+ };
999
+ meta: object;
1000
+ }>;
1001
+ }>>;
1002
+ content: import("@trpc/server").TRPCBuiltRouter<{
1003
+ ctx: import("@synap/api").Context;
1004
+ meta: object;
1005
+ errorShape: import("@trpc/server").TRPCDefaultErrorShape;
1006
+ transformer: false;
1007
+ }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
1008
+ createFromText: import("@trpc/server").TRPCMutationProcedure<{
1009
+ input: {
1010
+ content: string;
1011
+ targetType: "note" | "task";
1012
+ metadata?: {
1013
+ tags?: string[] | undefined;
1014
+ title?: string | undefined;
1015
+ } | undefined;
1016
+ };
1017
+ output: {
1018
+ success: boolean;
1019
+ status: "pending";
1020
+ requestId: `${string}-${string}-${string}-${string}-${string}`;
1021
+ entityId: `${string}-${string}-${string}-${string}-${string}`;
1022
+ };
1023
+ meta: object;
1024
+ }>;
1025
+ createFromFile: import("@trpc/server").TRPCMutationProcedure<{
1026
+ input: {
1027
+ targetType: "note" | "document";
1028
+ file: string;
1029
+ filename: string;
1030
+ contentType: string;
1031
+ metadata?: {
1032
+ description?: string | undefined;
1033
+ tags?: string[] | undefined;
1034
+ title?: string | undefined;
1035
+ } | undefined;
1036
+ };
1037
+ output: any;
1038
+ meta: object;
1039
+ }>;
1040
+ }>>;
1041
+ files: import("@trpc/server").TRPCBuiltRouter<{
1042
+ ctx: import("@synap/api").Context;
1043
+ meta: object;
1044
+ errorShape: import("@trpc/server").TRPCDefaultErrorShape;
1045
+ transformer: false;
1046
+ }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
1047
+ listBuckets: import("@trpc/server").TRPCQueryProcedure<{
1048
+ input: void;
1049
+ output: {
1050
+ buckets: {
1051
+ name: string;
1052
+ createdAt: string | null;
1053
+ }[];
1054
+ };
1055
+ meta: object;
1056
+ }>;
1057
+ listFiles: import("@trpc/server").TRPCQueryProcedure<{
1058
+ input: {
1059
+ bucket?: string | undefined;
1060
+ prefix?: string | undefined;
1061
+ maxKeys?: number | undefined;
1062
+ };
1063
+ output: {
1064
+ items: ({
1065
+ type: "folder";
1066
+ name: string;
1067
+ path: string;
1068
+ } | {
1069
+ type: "file";
1070
+ name: string;
1071
+ path: string;
1072
+ size: number;
1073
+ lastModified: string | null;
1074
+ })[];
1075
+ totalItems: number;
1076
+ prefix: string;
1077
+ bucket: string;
1078
+ isTruncated: boolean;
1079
+ error?: undefined;
1080
+ } | {
1081
+ items: never[];
1082
+ totalItems: number;
1083
+ prefix: string;
1084
+ bucket: string;
1085
+ isTruncated: boolean;
1086
+ error: string;
1087
+ };
1088
+ meta: object;
1089
+ }>;
1090
+ getFileMetadata: import("@trpc/server").TRPCQueryProcedure<{
1091
+ input: {
1092
+ path: string;
1093
+ };
1094
+ output: {
1095
+ success: boolean;
1096
+ path: string;
1097
+ size: number;
1098
+ lastModified: string;
1099
+ contentType: string;
1100
+ error?: undefined;
1101
+ } | {
1102
+ success: boolean;
1103
+ path: string;
1104
+ error: string;
1105
+ size?: undefined;
1106
+ lastModified?: undefined;
1107
+ contentType?: undefined;
1108
+ };
1109
+ meta: object;
1110
+ }>;
1111
+ getDownloadUrl: import("@trpc/server").TRPCQueryProcedure<{
1112
+ input: {
1113
+ path: string;
1114
+ expiresIn?: number | undefined;
1115
+ };
1116
+ output: {
1117
+ success: boolean;
1118
+ url: string;
1119
+ expiresIn: number;
1120
+ error?: undefined;
1121
+ } | {
1122
+ success: boolean;
1123
+ error: string;
1124
+ url?: undefined;
1125
+ expiresIn?: undefined;
1126
+ };
1127
+ meta: object;
1128
+ }>;
1129
+ exists: import("@trpc/server").TRPCQueryProcedure<{
1130
+ input: {
1131
+ path: string;
1132
+ };
1133
+ output: {
1134
+ exists: boolean;
1135
+ path: string;
1136
+ };
1137
+ meta: object;
1138
+ }>;
1139
+ deleteFile: import("@trpc/server").TRPCMutationProcedure<{
1140
+ input: {
1141
+ path: string;
1142
+ };
1143
+ output: {
1144
+ success: boolean;
1145
+ path: string;
1146
+ error?: undefined;
1147
+ } | {
1148
+ success: boolean;
1149
+ path: string;
1150
+ error: string;
1151
+ };
1152
+ meta: object;
1153
+ }>;
1154
+ }>>;
1155
+ tags: import("@trpc/server").TRPCBuiltRouter<{
1156
+ ctx: import("@synap/api").Context;
1157
+ meta: object;
1158
+ errorShape: import("@trpc/server").TRPCDefaultErrorShape;
1159
+ transformer: false;
1160
+ }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
1161
+ list: import("@trpc/server").TRPCQueryProcedure<{
1162
+ input: void;
1163
+ output: {
1164
+ tags: {
1165
+ userId: string;
1166
+ name: string;
1167
+ id: string;
1168
+ createdAt: Date;
1169
+ color: string | null;
1170
+ }[];
1171
+ };
1172
+ meta: object;
1173
+ }>;
1174
+ create: import("@trpc/server").TRPCMutationProcedure<{
1175
+ input: {
1176
+ name: string;
1177
+ color?: string | undefined;
1178
+ };
1179
+ output: {
1180
+ tag: {
1181
+ userId: string;
1182
+ name: string;
1183
+ id: string;
1184
+ createdAt: Date;
1185
+ color: string | null;
1186
+ };
1187
+ };
1188
+ meta: object;
1189
+ }>;
1190
+ update: import("@trpc/server").TRPCMutationProcedure<{
1191
+ input: {
1192
+ id: string;
1193
+ name?: string | undefined;
1194
+ color?: string | undefined;
1195
+ };
1196
+ output: {
1197
+ tag: {
1198
+ userId: string;
1199
+ name: string;
1200
+ id: string;
1201
+ createdAt: Date;
1202
+ color: string | null;
1203
+ };
1204
+ };
1205
+ meta: object;
1206
+ }>;
1207
+ delete: import("@trpc/server").TRPCMutationProcedure<{
1208
+ input: {
1209
+ id: string;
1210
+ };
1211
+ output: {
1212
+ success: boolean;
1213
+ };
1214
+ meta: object;
1215
+ }>;
1216
+ attach: import("@trpc/server").TRPCMutationProcedure<{
1217
+ input: {
1218
+ entityId: string;
1219
+ tagId: string;
1220
+ };
1221
+ output: {
1222
+ success: boolean;
1223
+ };
1224
+ meta: object;
1225
+ }>;
1226
+ detach: import("@trpc/server").TRPCMutationProcedure<{
1227
+ input: {
1228
+ entityId: string;
1229
+ tagId: string;
1230
+ };
1231
+ output: {
1232
+ success: boolean;
1233
+ };
1234
+ meta: object;
1235
+ }>;
1236
+ getForEntity: import("@trpc/server").TRPCQueryProcedure<{
1237
+ input: {
1238
+ entityId: string;
1239
+ };
1240
+ output: {
1241
+ tags: any[];
1242
+ };
1243
+ meta: object;
1244
+ }>;
1245
+ getEntitiesWithTag: import("@trpc/server").TRPCQueryProcedure<{
1246
+ input: {
1247
+ tagId: string;
1248
+ limit?: number | undefined;
1249
+ };
1250
+ output: {
1251
+ entities: any[];
1252
+ };
1253
+ meta: object;
1254
+ }>;
1255
+ }>>;
1256
+ search: import("@trpc/server").TRPCBuiltRouter<{
1257
+ ctx: import("@synap/api").Context;
1258
+ meta: object;
1259
+ errorShape: import("@trpc/server").TRPCDefaultErrorShape;
1260
+ transformer: false;
1261
+ }, import("@trpc/server").TRPCDecorateCreateRouterOptions<{
1262
+ entities: import("@trpc/server").TRPCQueryProcedure<{
1263
+ input: {
1264
+ query: string;
1265
+ type?: "note" | "task" | "project" | "document" | undefined;
1266
+ limit?: number | undefined;
1267
+ };
1268
+ output: {
1269
+ entities: {
1270
+ userId: string;
1271
+ version: number;
1272
+ metadata: unknown;
1273
+ id: string;
1274
+ type: string;
1275
+ title: string | null;
1276
+ preview: string | null;
1277
+ documentId: string | null;
1278
+ fileUrl: string | null;
1279
+ filePath: string | null;
1280
+ fileSize: number | null;
1281
+ fileType: string | null;
1282
+ checksum: string | null;
1283
+ createdAt: Date;
1284
+ updatedAt: Date;
1285
+ deletedAt: Date | null;
1286
+ }[];
1287
+ };
1288
+ meta: object;
1289
+ }>;
1290
+ semantic: import("@trpc/server").TRPCQueryProcedure<{
1291
+ input: {
1292
+ query: string;
1293
+ type?: "note" | "task" | "project" | "document" | undefined;
1294
+ limit?: number | undefined;
1295
+ threshold?: number | undefined;
1296
+ };
1297
+ output: {
1298
+ entities: never[];
1299
+ message: string;
1300
+ };
1301
+ meta: object;
1302
+ }>;
1303
+ related: import("@trpc/server").TRPCQueryProcedure<{
1304
+ input: {
1305
+ entityId: string;
1306
+ limit?: number | undefined;
1307
+ };
1308
+ output: {
1309
+ entities: {
1310
+ userId: string;
1311
+ version: number;
1312
+ metadata: unknown;
1313
+ id: string;
1314
+ type: string;
1315
+ title: string | null;
1316
+ preview: string | null;
1317
+ documentId: string | null;
1318
+ fileUrl: string | null;
1319
+ filePath: string | null;
1320
+ fileSize: number | null;
1321
+ fileType: string | null;
1322
+ checksum: string | null;
1323
+ createdAt: Date;
1324
+ updatedAt: Date;
1325
+ deletedAt: Date | null;
1326
+ }[];
1327
+ };
1328
+ meta: object;
1329
+ }>;
1330
+ byTags: import("@trpc/server").TRPCQueryProcedure<{
1331
+ input: {
1332
+ tagIds: string[];
1333
+ limit?: number | undefined;
1334
+ };
1335
+ output: {
1336
+ entities: any[];
1337
+ };
1338
+ meta: object;
1339
+ }>;
1340
+ }>>;
1341
+ }>>>;
1342
+ /**
1343
+ * Type alias for the Synap TRP client
1344
+ */
1345
+ export type SynapClient = ReturnType<typeof createSynapClient>;
1346
+ export type { AppRouter } from '@synap/api';
1347
+ export type { TRPCClient } from '@trpc/client';
1348
+ export default createSynapClient;