@polinetwork/backend 0.9.1 → 0.10.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.
package/dist/index.cjs CHANGED
@@ -21,16 +21,19 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var index_exports = {};
22
22
  __export(index_exports, {
23
23
  AUTH_PATH: () => AUTH_PATH,
24
- TRPC_PATH: () => TRPC_PATH
24
+ TRPC_PATH: () => TRPC_PATH,
25
+ WS_PATH: () => WS_PATH
25
26
  });
26
27
  module.exports = __toCommonJS(index_exports);
27
28
 
28
29
  // src/constants.ts
29
30
  var TRPC_PATH = "/api/trpc";
30
31
  var AUTH_PATH = "/api/auth";
32
+ var WS_PATH = "/ws";
31
33
  // Annotate the CommonJS export names for ESM import in node:
32
34
  0 && (module.exports = {
33
35
  AUTH_PATH,
34
- TRPC_PATH
36
+ TRPC_PATH,
37
+ WS_PATH
35
38
  });
36
39
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/constants.ts"],"sourcesContent":["export { TRPC_PATH, AUTH_PATH } from \"./constants\"\nexport { type AppRouter } from \"./routers\"\nimport type { telegramPlugin } from \"./auth/plugins/telegram\"\n\nexport type TelegramPlugin = typeof telegramPlugin\n","export const TRPC_PATH = \"/api/trpc\";\nexport const AUTH_PATH = \"/api/auth\";\n\nexport const TRUSTED_ORIGINS = [\n \"http://localhost:3001\",\n \"http://localhost:3002\",\n \"http://localhost:3003\",\n \"http://localhost:5173\",\n \"http://localhost:5174\",\n \"http://localhost:5175\",\n]\n\nexport const MESSAGES_RETENTION_DAYS = 7\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,YAAY;AAClB,IAAM,YAAY;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/constants.ts"],"sourcesContent":["export { AUTH_PATH, TRPC_PATH, WS_PATH } from \"./constants\"\nexport type { AppRouter } from \"./routers\"\n\nimport type { telegramPlugin } from \"./auth/plugins/telegram\"\nexport type TelegramPlugin = typeof telegramPlugin\n\nexport type { TelegramSocket } from \"./websocket/telegram\"\n","export const TRPC_PATH = \"/api/trpc\"\nexport const AUTH_PATH = \"/api/auth\"\nexport const WS_PATH = \"/ws\"\n\nexport const TRUSTED_ORIGINS = [\n \"http://localhost:3001\",\n \"http://localhost:3002\",\n \"http://localhost:3003\",\n \"http://localhost:5173\",\n \"http://localhost:5174\",\n \"http://localhost:5175\",\n]\n\nexport const MESSAGES_RETENTION_DAYS = 7\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,YAAY;AAClB,IAAM,YAAY;AAClB,IAAM,UAAU;","names":[]}
package/dist/index.d.cts CHANGED
@@ -1,10 +1,11 @@
1
1
  import * as _trpc_server from '@trpc/server';
2
- import * as _trpc_server_unstable_core_do_not_import from '@trpc/server/unstable-core-do-not-import';
3
2
  import * as better_auth from 'better-auth';
4
- import { z } from 'zod/v4';
3
+ import { z } from 'zod';
4
+ import { Socket } from 'socket.io-client';
5
5
 
6
6
  declare const TRPC_PATH = "/api/trpc";
7
7
  declare const AUTH_PATH = "/api/auth";
8
+ declare const WS_PATH = "/ws";
8
9
 
9
10
  declare const AUDIT_TYPE: {
10
11
  readonly BAN: "ban";
@@ -20,7 +21,7 @@ type TAuditType = (typeof AUDIT_TYPE)[keyof typeof AUDIT_TYPE];
20
21
  *
21
22
  * All routers added in /api/routers should be manually added here.
22
23
  */
23
- declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
24
+ declare const appRouter: _trpc_server.TRPCBuiltRouter<{
24
25
  ctx: {
25
26
  userId?: string;
26
27
  };
@@ -30,17 +31,17 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
30
31
  zodError: {
31
32
  errors: string[];
32
33
  } | null;
33
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_KEY;
34
+ code: _trpc_server.TRPC_ERROR_CODE_KEY;
34
35
  httpStatus: number;
35
36
  path?: string;
36
37
  stack?: string;
37
38
  };
38
39
  message: string;
39
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_NUMBER;
40
+ code: _trpc_server.TRPC_ERROR_CODE_NUMBER;
40
41
  };
41
42
  transformer: true;
42
- }, _trpc_server_unstable_core_do_not_import.DecorateCreateRouterOptions<{
43
- test: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
43
+ }, _trpc_server.TRPCDecorateCreateRouterOptions<{
44
+ test: _trpc_server.TRPCBuiltRouter<{
44
45
  ctx: {
45
46
  userId?: string;
46
47
  };
@@ -50,21 +51,22 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
50
51
  zodError: {
51
52
  errors: string[];
52
53
  } | null;
53
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_KEY;
54
+ code: _trpc_server.TRPC_ERROR_CODE_KEY;
54
55
  httpStatus: number;
55
56
  path?: string;
56
57
  stack?: string;
57
58
  };
58
59
  message: string;
59
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_NUMBER;
60
+ code: _trpc_server.TRPC_ERROR_CODE_NUMBER;
60
61
  };
61
62
  transformer: true;
62
- }, _trpc_server_unstable_core_do_not_import.DecorateCreateRouterOptions<{
63
+ }, _trpc_server.TRPCDecorateCreateRouterOptions<{
63
64
  dbQuery: _trpc_server.TRPCQueryProcedure<{
64
65
  input: {
65
66
  dbName: "web" | "tg";
66
67
  };
67
68
  output: string[];
69
+ meta: object;
68
70
  }>;
69
71
  dbInsert: _trpc_server.TRPCMutationProcedure<{
70
72
  input: {
@@ -72,9 +74,10 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
72
74
  dbName: "web" | "tg";
73
75
  };
74
76
  output: boolean;
77
+ meta: object;
75
78
  }>;
76
79
  }>>;
77
- tg: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
80
+ tg: _trpc_server.TRPCBuiltRouter<{
78
81
  ctx: {
79
82
  userId?: string;
80
83
  };
@@ -84,17 +87,17 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
84
87
  zodError: {
85
88
  errors: string[];
86
89
  } | null;
87
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_KEY;
90
+ code: _trpc_server.TRPC_ERROR_CODE_KEY;
88
91
  httpStatus: number;
89
92
  path?: string;
90
93
  stack?: string;
91
94
  };
92
95
  message: string;
93
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_NUMBER;
96
+ code: _trpc_server.TRPC_ERROR_CODE_NUMBER;
94
97
  };
95
98
  transformer: true;
96
- }, _trpc_server_unstable_core_do_not_import.DecorateCreateRouterOptions<{
97
- groups: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
99
+ }, _trpc_server.TRPCDecorateCreateRouterOptions<{
100
+ groups: _trpc_server.TRPCBuiltRouter<{
98
101
  ctx: {
99
102
  userId?: string;
100
103
  };
@@ -104,16 +107,16 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
104
107
  zodError: {
105
108
  errors: string[];
106
109
  } | null;
107
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_KEY;
110
+ code: _trpc_server.TRPC_ERROR_CODE_KEY;
108
111
  httpStatus: number;
109
112
  path?: string;
110
113
  stack?: string;
111
114
  };
112
115
  message: string;
113
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_NUMBER;
116
+ code: _trpc_server.TRPC_ERROR_CODE_NUMBER;
114
117
  };
115
118
  transformer: true;
116
- }, _trpc_server_unstable_core_do_not_import.DecorateCreateRouterOptions<{
119
+ }, _trpc_server.TRPCDecorateCreateRouterOptions<{
117
120
  getAll: _trpc_server.TRPCQueryProcedure<{
118
121
  input: void;
119
122
  output: {
@@ -123,6 +126,7 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
123
126
  title: string;
124
127
  link: string | null;
125
128
  }[];
129
+ meta: object;
126
130
  }>;
127
131
  search: _trpc_server.TRPCQueryProcedure<{
128
132
  input: {
@@ -137,6 +141,7 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
137
141
  }[];
138
142
  count: number;
139
143
  };
144
+ meta: object;
140
145
  }>;
141
146
  getById: _trpc_server.TRPCQueryProcedure<{
142
147
  input: {
@@ -149,6 +154,7 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
149
154
  title: string;
150
155
  link: string | null;
151
156
  }[];
157
+ meta: object;
152
158
  }>;
153
159
  create: _trpc_server.TRPCMutationProcedure<{
154
160
  input: {
@@ -157,15 +163,17 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
157
163
  link: string;
158
164
  }[];
159
165
  output: number[];
166
+ meta: object;
160
167
  }>;
161
168
  delete: _trpc_server.TRPCMutationProcedure<{
162
169
  input: {
163
170
  telegramId: number;
164
171
  };
165
172
  output: boolean;
173
+ meta: object;
166
174
  }>;
167
175
  }>>;
168
- permissions: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
176
+ permissions: _trpc_server.TRPCBuiltRouter<{
169
177
  ctx: {
170
178
  userId?: string;
171
179
  };
@@ -175,16 +183,16 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
175
183
  zodError: {
176
184
  errors: string[];
177
185
  } | null;
178
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_KEY;
186
+ code: _trpc_server.TRPC_ERROR_CODE_KEY;
179
187
  httpStatus: number;
180
188
  path?: string;
181
189
  stack?: string;
182
190
  };
183
191
  message: string;
184
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_NUMBER;
192
+ code: _trpc_server.TRPC_ERROR_CODE_NUMBER;
185
193
  };
186
194
  transformer: true;
187
- }, _trpc_server_unstable_core_do_not_import.DecorateCreateRouterOptions<{
195
+ }, _trpc_server.TRPCDecorateCreateRouterOptions<{
188
196
  getRole: _trpc_server.TRPCQueryProcedure<{
189
197
  input: {
190
198
  userId: number;
@@ -193,6 +201,7 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
193
201
  userId: number;
194
202
  role: string;
195
203
  };
204
+ meta: object;
196
205
  }>;
197
206
  setRole: _trpc_server.TRPCQueryProcedure<{
198
207
  input: {
@@ -201,6 +210,7 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
201
210
  adderId: number;
202
211
  };
203
212
  output: void;
213
+ meta: object;
204
214
  }>;
205
215
  checkGroup: _trpc_server.TRPCQueryProcedure<{
206
216
  input: {
@@ -208,6 +218,7 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
208
218
  groupId: number;
209
219
  };
210
220
  output: boolean;
221
+ meta: object;
211
222
  }>;
212
223
  addGroup: _trpc_server.TRPCQueryProcedure<{
213
224
  input: {
@@ -216,6 +227,7 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
216
227
  groupId: number;
217
228
  };
218
229
  output: void;
230
+ meta: object;
219
231
  }>;
220
232
  canAddBot: _trpc_server.TRPCQueryProcedure<{
221
233
  input: {
@@ -228,9 +240,10 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
228
240
  allowed: false;
229
241
  error: "NOT_FOUND";
230
242
  };
243
+ meta: object;
231
244
  }>;
232
245
  }>>;
233
- link: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
246
+ link: _trpc_server.TRPCBuiltRouter<{
234
247
  ctx: {
235
248
  userId?: string;
236
249
  };
@@ -240,16 +253,16 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
240
253
  zodError: {
241
254
  errors: string[];
242
255
  } | null;
243
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_KEY;
256
+ code: _trpc_server.TRPC_ERROR_CODE_KEY;
244
257
  httpStatus: number;
245
258
  path?: string;
246
259
  stack?: string;
247
260
  };
248
261
  message: string;
249
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_NUMBER;
262
+ code: _trpc_server.TRPC_ERROR_CODE_NUMBER;
250
263
  };
251
264
  transformer: true;
252
- }, _trpc_server_unstable_core_do_not_import.DecorateCreateRouterOptions<{
265
+ }, _trpc_server.TRPCDecorateCreateRouterOptions<{
253
266
  link: _trpc_server.TRPCQueryProcedure<{
254
267
  input: {
255
268
  code: string;
@@ -263,9 +276,10 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
263
276
  success: boolean;
264
277
  error: undefined;
265
278
  };
279
+ meta: object;
266
280
  }>;
267
281
  }>>;
268
- messages: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
282
+ messages: _trpc_server.TRPCBuiltRouter<{
269
283
  ctx: {
270
284
  userId?: string;
271
285
  };
@@ -275,16 +289,16 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
275
289
  zodError: {
276
290
  errors: string[];
277
291
  } | null;
278
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_KEY;
292
+ code: _trpc_server.TRPC_ERROR_CODE_KEY;
279
293
  httpStatus: number;
280
294
  path?: string;
281
295
  stack?: string;
282
296
  };
283
297
  message: string;
284
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_NUMBER;
298
+ code: _trpc_server.TRPC_ERROR_CODE_NUMBER;
285
299
  };
286
300
  transformer: true;
287
- }, _trpc_server_unstable_core_do_not_import.DecorateCreateRouterOptions<{
301
+ }, _trpc_server.TRPCDecorateCreateRouterOptions<{
288
302
  get: _trpc_server.TRPCQueryProcedure<{
289
303
  input: {
290
304
  chatId: number;
@@ -303,6 +317,7 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
303
317
  message: null;
304
318
  error: "NOT_FOUND" | "DECRYPT_ERROR";
305
319
  };
320
+ meta: object;
306
321
  }>;
307
322
  add: _trpc_server.TRPCMutationProcedure<{
308
323
  input: {
@@ -317,9 +332,10 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
317
332
  output: {
318
333
  error: "ENCRYPT_ERROR" | null;
319
334
  };
335
+ meta: object;
320
336
  }>;
321
337
  }>>;
322
- auditLog: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
338
+ auditLog: _trpc_server.TRPCBuiltRouter<{
323
339
  ctx: {
324
340
  userId?: string;
325
341
  };
@@ -329,16 +345,16 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
329
345
  zodError: {
330
346
  errors: string[];
331
347
  } | null;
332
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_KEY;
348
+ code: _trpc_server.TRPC_ERROR_CODE_KEY;
333
349
  httpStatus: number;
334
350
  path?: string;
335
351
  stack?: string;
336
352
  };
337
353
  message: string;
338
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_NUMBER;
354
+ code: _trpc_server.TRPC_ERROR_CODE_NUMBER;
339
355
  };
340
356
  transformer: true;
341
- }, _trpc_server_unstable_core_do_not_import.DecorateCreateRouterOptions<{
357
+ }, _trpc_server.TRPCDecorateCreateRouterOptions<{
342
358
  create: _trpc_server.TRPCMutationProcedure<{
343
359
  input: {
344
360
  adminId: number;
@@ -349,6 +365,7 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
349
365
  reason?: string | undefined;
350
366
  };
351
367
  output: void;
368
+ meta: object;
352
369
  }>;
353
370
  getById: _trpc_server.TRPCQueryProcedure<{
354
371
  input: {
@@ -366,6 +383,7 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
366
383
  until: Date | null;
367
384
  reason: string | null;
368
385
  }[];
386
+ meta: object;
369
387
  }>;
370
388
  }>>;
371
389
  }>>;
@@ -415,11 +433,37 @@ declare const telegramPlugin: () => {
415
433
  returnHeaders?: ReturnHeaders | undefined;
416
434
  }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
417
435
  headers: Headers;
418
- response: better_auth.APIError | {
436
+ response: {
437
+ status: ("BAD_REQUEST" | "INTERNAL_SERVER_ERROR" | "NOT_IMPLEMENTED" | "BAD_GATEWAY" | "SERVICE_UNAVAILABLE" | "GATEWAY_TIMEOUT" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "CONFLICT" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "UNSUPPORTED_MEDIA_TYPE" | "TOO_MANY_REQUESTS" | "OK" | "CREATED" | "ACCEPTED" | "NO_CONTENT" | "MULTIPLE_CHOICES" | "MOVED_PERMANENTLY" | "FOUND" | "SEE_OTHER" | "NOT_MODIFIED" | "TEMPORARY_REDIRECT" | "METHOD_NOT_ALLOWED" | "NOT_ACCEPTABLE" | "PROXY_AUTHENTICATION_REQUIRED" | "REQUEST_TIMEOUT" | "GONE" | "LENGTH_REQUIRED" | "URI_TOO_LONG" | "RANGE_NOT_SATISFIABLE" | "EXPECTATION_FAILED" | "I'M_A_TEAPOT" | "MISDIRECTED_REQUEST" | "UNPROCESSABLE_ENTITY" | "LOCKED" | "FAILED_DEPENDENCY" | "TOO_EARLY" | "UPGRADE_REQUIRED" | "PRECONDITION_REQUIRED" | "REQUEST_HEADER_FIELDS_TOO_LARGE" | "UNAVAILABLE_FOR_LEGAL_REASONS" | "HTTP_VERSION_NOT_SUPPORTED" | "VARIANT_ALSO_NEGOTIATES" | "INSUFFICIENT_STORAGE" | "LOOP_DETECTED" | "NOT_EXTENDED" | "NETWORK_AUTHENTICATION_REQUIRED") | better_auth.Status;
438
+ body: ({
439
+ message?: string;
440
+ code?: string;
441
+ cause?: unknown;
442
+ } & Record<string, any>) | undefined;
443
+ headers: HeadersInit;
444
+ statusCode: number;
445
+ name: string;
446
+ message: string;
447
+ stack?: string;
448
+ cause?: unknown;
449
+ } | {
419
450
  code: string;
420
451
  ttl: number;
421
452
  };
422
- } : better_auth.APIError | {
453
+ } : {
454
+ status: ("BAD_REQUEST" | "INTERNAL_SERVER_ERROR" | "NOT_IMPLEMENTED" | "BAD_GATEWAY" | "SERVICE_UNAVAILABLE" | "GATEWAY_TIMEOUT" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "CONFLICT" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "UNSUPPORTED_MEDIA_TYPE" | "TOO_MANY_REQUESTS" | "OK" | "CREATED" | "ACCEPTED" | "NO_CONTENT" | "MULTIPLE_CHOICES" | "MOVED_PERMANENTLY" | "FOUND" | "SEE_OTHER" | "NOT_MODIFIED" | "TEMPORARY_REDIRECT" | "METHOD_NOT_ALLOWED" | "NOT_ACCEPTABLE" | "PROXY_AUTHENTICATION_REQUIRED" | "REQUEST_TIMEOUT" | "GONE" | "LENGTH_REQUIRED" | "URI_TOO_LONG" | "RANGE_NOT_SATISFIABLE" | "EXPECTATION_FAILED" | "I'M_A_TEAPOT" | "MISDIRECTED_REQUEST" | "UNPROCESSABLE_ENTITY" | "LOCKED" | "FAILED_DEPENDENCY" | "TOO_EARLY" | "UPGRADE_REQUIRED" | "PRECONDITION_REQUIRED" | "REQUEST_HEADER_FIELDS_TOO_LARGE" | "UNAVAILABLE_FOR_LEGAL_REASONS" | "HTTP_VERSION_NOT_SUPPORTED" | "VARIANT_ALSO_NEGOTIATES" | "INSUFFICIENT_STORAGE" | "LOOP_DETECTED" | "NOT_EXTENDED" | "NETWORK_AUTHENTICATION_REQUIRED") | better_auth.Status;
455
+ body: ({
456
+ message?: string;
457
+ code?: string;
458
+ cause?: unknown;
459
+ } & Record<string, any>) | undefined;
460
+ headers: HeadersInit;
461
+ statusCode: number;
462
+ name: string;
463
+ message: string;
464
+ stack?: string;
465
+ cause?: unknown;
466
+ } | {
423
467
  code: string;
424
468
  ttl: number;
425
469
  }>;
@@ -439,11 +483,11 @@ declare const telegramPlugin: () => {
439
483
  };
440
484
  user: Record<string, any> & {
441
485
  id: string;
442
- name: string;
443
- email: string;
444
- emailVerified: boolean;
445
486
  createdAt: Date;
446
487
  updatedAt: Date;
488
+ email: string;
489
+ emailVerified: boolean;
490
+ name: string;
447
491
  image?: string | null | undefined;
448
492
  };
449
493
  };
@@ -481,11 +525,37 @@ declare const telegramPlugin: () => {
481
525
  returnHeaders?: ReturnHeaders | undefined;
482
526
  }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
483
527
  headers: Headers;
484
- response: better_auth.APIError | {
528
+ response: {
529
+ status: ("BAD_REQUEST" | "INTERNAL_SERVER_ERROR" | "NOT_IMPLEMENTED" | "BAD_GATEWAY" | "SERVICE_UNAVAILABLE" | "GATEWAY_TIMEOUT" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "CONFLICT" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "UNSUPPORTED_MEDIA_TYPE" | "TOO_MANY_REQUESTS" | "OK" | "CREATED" | "ACCEPTED" | "NO_CONTENT" | "MULTIPLE_CHOICES" | "MOVED_PERMANENTLY" | "FOUND" | "SEE_OTHER" | "NOT_MODIFIED" | "TEMPORARY_REDIRECT" | "METHOD_NOT_ALLOWED" | "NOT_ACCEPTABLE" | "PROXY_AUTHENTICATION_REQUIRED" | "REQUEST_TIMEOUT" | "GONE" | "LENGTH_REQUIRED" | "URI_TOO_LONG" | "RANGE_NOT_SATISFIABLE" | "EXPECTATION_FAILED" | "I'M_A_TEAPOT" | "MISDIRECTED_REQUEST" | "UNPROCESSABLE_ENTITY" | "LOCKED" | "FAILED_DEPENDENCY" | "TOO_EARLY" | "UPGRADE_REQUIRED" | "PRECONDITION_REQUIRED" | "REQUEST_HEADER_FIELDS_TOO_LARGE" | "UNAVAILABLE_FOR_LEGAL_REASONS" | "HTTP_VERSION_NOT_SUPPORTED" | "VARIANT_ALSO_NEGOTIATES" | "INSUFFICIENT_STORAGE" | "LOOP_DETECTED" | "NOT_EXTENDED" | "NETWORK_AUTHENTICATION_REQUIRED") | better_auth.Status;
530
+ body: ({
531
+ message?: string;
532
+ code?: string;
533
+ cause?: unknown;
534
+ } & Record<string, any>) | undefined;
535
+ headers: HeadersInit;
536
+ statusCode: number;
537
+ name: string;
538
+ message: string;
539
+ stack?: string;
540
+ cause?: unknown;
541
+ } | {
485
542
  expired: boolean;
486
543
  verified: boolean;
487
544
  };
488
- } : better_auth.APIError | {
545
+ } : {
546
+ status: ("BAD_REQUEST" | "INTERNAL_SERVER_ERROR" | "NOT_IMPLEMENTED" | "BAD_GATEWAY" | "SERVICE_UNAVAILABLE" | "GATEWAY_TIMEOUT" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "CONFLICT" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "UNSUPPORTED_MEDIA_TYPE" | "TOO_MANY_REQUESTS" | "OK" | "CREATED" | "ACCEPTED" | "NO_CONTENT" | "MULTIPLE_CHOICES" | "MOVED_PERMANENTLY" | "FOUND" | "SEE_OTHER" | "NOT_MODIFIED" | "TEMPORARY_REDIRECT" | "METHOD_NOT_ALLOWED" | "NOT_ACCEPTABLE" | "PROXY_AUTHENTICATION_REQUIRED" | "REQUEST_TIMEOUT" | "GONE" | "LENGTH_REQUIRED" | "URI_TOO_LONG" | "RANGE_NOT_SATISFIABLE" | "EXPECTATION_FAILED" | "I'M_A_TEAPOT" | "MISDIRECTED_REQUEST" | "UNPROCESSABLE_ENTITY" | "LOCKED" | "FAILED_DEPENDENCY" | "TOO_EARLY" | "UPGRADE_REQUIRED" | "PRECONDITION_REQUIRED" | "REQUEST_HEADER_FIELDS_TOO_LARGE" | "UNAVAILABLE_FOR_LEGAL_REASONS" | "HTTP_VERSION_NOT_SUPPORTED" | "VARIANT_ALSO_NEGOTIATES" | "INSUFFICIENT_STORAGE" | "LOOP_DETECTED" | "NOT_EXTENDED" | "NETWORK_AUTHENTICATION_REQUIRED") | better_auth.Status;
547
+ body: ({
548
+ message?: string;
549
+ code?: string;
550
+ cause?: unknown;
551
+ } & Record<string, any>) | undefined;
552
+ headers: HeadersInit;
553
+ statusCode: number;
554
+ name: string;
555
+ message: string;
556
+ stack?: string;
557
+ cause?: unknown;
558
+ } | {
489
559
  expired: boolean;
490
560
  verified: boolean;
491
561
  }>;
@@ -505,11 +575,11 @@ declare const telegramPlugin: () => {
505
575
  };
506
576
  user: Record<string, any> & {
507
577
  id: string;
508
- name: string;
509
- email: string;
510
- emailVerified: boolean;
511
578
  createdAt: Date;
512
579
  updatedAt: Date;
580
+ email: string;
581
+ emailVerified: boolean;
582
+ name: string;
513
583
  image?: string | null | undefined;
514
584
  };
515
585
  };
@@ -525,6 +595,16 @@ declare const telegramPlugin: () => {
525
595
  };
526
596
  };
527
597
 
598
+ interface ToClient {
599
+ ban: (data: {
600
+ chatId: number;
601
+ userId: number;
602
+ durationInSeconds?: number;
603
+ }, cb: (error: string | null) => void) => void;
604
+ }
605
+ type ToServer = {};
606
+ type TelegramSocket = Socket<ToClient, ToServer>;
607
+
528
608
  type TelegramPlugin = typeof telegramPlugin;
529
609
 
530
- export { AUTH_PATH, type AppRouter, TRPC_PATH, type TelegramPlugin };
610
+ export { AUTH_PATH, type AppRouter, TRPC_PATH, type TelegramPlugin, type TelegramSocket, WS_PATH };
package/dist/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import * as _trpc_server from '@trpc/server';
2
- import * as _trpc_server_unstable_core_do_not_import from '@trpc/server/unstable-core-do-not-import';
3
2
  import * as better_auth from 'better-auth';
4
- import { z } from 'zod/v4';
3
+ import { z } from 'zod';
4
+ import { Socket } from 'socket.io-client';
5
5
 
6
6
  declare const TRPC_PATH = "/api/trpc";
7
7
  declare const AUTH_PATH = "/api/auth";
8
+ declare const WS_PATH = "/ws";
8
9
 
9
10
  declare const AUDIT_TYPE: {
10
11
  readonly BAN: "ban";
@@ -20,7 +21,7 @@ type TAuditType = (typeof AUDIT_TYPE)[keyof typeof AUDIT_TYPE];
20
21
  *
21
22
  * All routers added in /api/routers should be manually added here.
22
23
  */
23
- declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
24
+ declare const appRouter: _trpc_server.TRPCBuiltRouter<{
24
25
  ctx: {
25
26
  userId?: string;
26
27
  };
@@ -30,17 +31,17 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
30
31
  zodError: {
31
32
  errors: string[];
32
33
  } | null;
33
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_KEY;
34
+ code: _trpc_server.TRPC_ERROR_CODE_KEY;
34
35
  httpStatus: number;
35
36
  path?: string;
36
37
  stack?: string;
37
38
  };
38
39
  message: string;
39
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_NUMBER;
40
+ code: _trpc_server.TRPC_ERROR_CODE_NUMBER;
40
41
  };
41
42
  transformer: true;
42
- }, _trpc_server_unstable_core_do_not_import.DecorateCreateRouterOptions<{
43
- test: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
43
+ }, _trpc_server.TRPCDecorateCreateRouterOptions<{
44
+ test: _trpc_server.TRPCBuiltRouter<{
44
45
  ctx: {
45
46
  userId?: string;
46
47
  };
@@ -50,21 +51,22 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
50
51
  zodError: {
51
52
  errors: string[];
52
53
  } | null;
53
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_KEY;
54
+ code: _trpc_server.TRPC_ERROR_CODE_KEY;
54
55
  httpStatus: number;
55
56
  path?: string;
56
57
  stack?: string;
57
58
  };
58
59
  message: string;
59
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_NUMBER;
60
+ code: _trpc_server.TRPC_ERROR_CODE_NUMBER;
60
61
  };
61
62
  transformer: true;
62
- }, _trpc_server_unstable_core_do_not_import.DecorateCreateRouterOptions<{
63
+ }, _trpc_server.TRPCDecorateCreateRouterOptions<{
63
64
  dbQuery: _trpc_server.TRPCQueryProcedure<{
64
65
  input: {
65
66
  dbName: "web" | "tg";
66
67
  };
67
68
  output: string[];
69
+ meta: object;
68
70
  }>;
69
71
  dbInsert: _trpc_server.TRPCMutationProcedure<{
70
72
  input: {
@@ -72,9 +74,10 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
72
74
  dbName: "web" | "tg";
73
75
  };
74
76
  output: boolean;
77
+ meta: object;
75
78
  }>;
76
79
  }>>;
77
- tg: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
80
+ tg: _trpc_server.TRPCBuiltRouter<{
78
81
  ctx: {
79
82
  userId?: string;
80
83
  };
@@ -84,17 +87,17 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
84
87
  zodError: {
85
88
  errors: string[];
86
89
  } | null;
87
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_KEY;
90
+ code: _trpc_server.TRPC_ERROR_CODE_KEY;
88
91
  httpStatus: number;
89
92
  path?: string;
90
93
  stack?: string;
91
94
  };
92
95
  message: string;
93
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_NUMBER;
96
+ code: _trpc_server.TRPC_ERROR_CODE_NUMBER;
94
97
  };
95
98
  transformer: true;
96
- }, _trpc_server_unstable_core_do_not_import.DecorateCreateRouterOptions<{
97
- groups: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
99
+ }, _trpc_server.TRPCDecorateCreateRouterOptions<{
100
+ groups: _trpc_server.TRPCBuiltRouter<{
98
101
  ctx: {
99
102
  userId?: string;
100
103
  };
@@ -104,16 +107,16 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
104
107
  zodError: {
105
108
  errors: string[];
106
109
  } | null;
107
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_KEY;
110
+ code: _trpc_server.TRPC_ERROR_CODE_KEY;
108
111
  httpStatus: number;
109
112
  path?: string;
110
113
  stack?: string;
111
114
  };
112
115
  message: string;
113
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_NUMBER;
116
+ code: _trpc_server.TRPC_ERROR_CODE_NUMBER;
114
117
  };
115
118
  transformer: true;
116
- }, _trpc_server_unstable_core_do_not_import.DecorateCreateRouterOptions<{
119
+ }, _trpc_server.TRPCDecorateCreateRouterOptions<{
117
120
  getAll: _trpc_server.TRPCQueryProcedure<{
118
121
  input: void;
119
122
  output: {
@@ -123,6 +126,7 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
123
126
  title: string;
124
127
  link: string | null;
125
128
  }[];
129
+ meta: object;
126
130
  }>;
127
131
  search: _trpc_server.TRPCQueryProcedure<{
128
132
  input: {
@@ -137,6 +141,7 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
137
141
  }[];
138
142
  count: number;
139
143
  };
144
+ meta: object;
140
145
  }>;
141
146
  getById: _trpc_server.TRPCQueryProcedure<{
142
147
  input: {
@@ -149,6 +154,7 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
149
154
  title: string;
150
155
  link: string | null;
151
156
  }[];
157
+ meta: object;
152
158
  }>;
153
159
  create: _trpc_server.TRPCMutationProcedure<{
154
160
  input: {
@@ -157,15 +163,17 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
157
163
  link: string;
158
164
  }[];
159
165
  output: number[];
166
+ meta: object;
160
167
  }>;
161
168
  delete: _trpc_server.TRPCMutationProcedure<{
162
169
  input: {
163
170
  telegramId: number;
164
171
  };
165
172
  output: boolean;
173
+ meta: object;
166
174
  }>;
167
175
  }>>;
168
- permissions: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
176
+ permissions: _trpc_server.TRPCBuiltRouter<{
169
177
  ctx: {
170
178
  userId?: string;
171
179
  };
@@ -175,16 +183,16 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
175
183
  zodError: {
176
184
  errors: string[];
177
185
  } | null;
178
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_KEY;
186
+ code: _trpc_server.TRPC_ERROR_CODE_KEY;
179
187
  httpStatus: number;
180
188
  path?: string;
181
189
  stack?: string;
182
190
  };
183
191
  message: string;
184
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_NUMBER;
192
+ code: _trpc_server.TRPC_ERROR_CODE_NUMBER;
185
193
  };
186
194
  transformer: true;
187
- }, _trpc_server_unstable_core_do_not_import.DecorateCreateRouterOptions<{
195
+ }, _trpc_server.TRPCDecorateCreateRouterOptions<{
188
196
  getRole: _trpc_server.TRPCQueryProcedure<{
189
197
  input: {
190
198
  userId: number;
@@ -193,6 +201,7 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
193
201
  userId: number;
194
202
  role: string;
195
203
  };
204
+ meta: object;
196
205
  }>;
197
206
  setRole: _trpc_server.TRPCQueryProcedure<{
198
207
  input: {
@@ -201,6 +210,7 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
201
210
  adderId: number;
202
211
  };
203
212
  output: void;
213
+ meta: object;
204
214
  }>;
205
215
  checkGroup: _trpc_server.TRPCQueryProcedure<{
206
216
  input: {
@@ -208,6 +218,7 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
208
218
  groupId: number;
209
219
  };
210
220
  output: boolean;
221
+ meta: object;
211
222
  }>;
212
223
  addGroup: _trpc_server.TRPCQueryProcedure<{
213
224
  input: {
@@ -216,6 +227,7 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
216
227
  groupId: number;
217
228
  };
218
229
  output: void;
230
+ meta: object;
219
231
  }>;
220
232
  canAddBot: _trpc_server.TRPCQueryProcedure<{
221
233
  input: {
@@ -228,9 +240,10 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
228
240
  allowed: false;
229
241
  error: "NOT_FOUND";
230
242
  };
243
+ meta: object;
231
244
  }>;
232
245
  }>>;
233
- link: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
246
+ link: _trpc_server.TRPCBuiltRouter<{
234
247
  ctx: {
235
248
  userId?: string;
236
249
  };
@@ -240,16 +253,16 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
240
253
  zodError: {
241
254
  errors: string[];
242
255
  } | null;
243
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_KEY;
256
+ code: _trpc_server.TRPC_ERROR_CODE_KEY;
244
257
  httpStatus: number;
245
258
  path?: string;
246
259
  stack?: string;
247
260
  };
248
261
  message: string;
249
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_NUMBER;
262
+ code: _trpc_server.TRPC_ERROR_CODE_NUMBER;
250
263
  };
251
264
  transformer: true;
252
- }, _trpc_server_unstable_core_do_not_import.DecorateCreateRouterOptions<{
265
+ }, _trpc_server.TRPCDecorateCreateRouterOptions<{
253
266
  link: _trpc_server.TRPCQueryProcedure<{
254
267
  input: {
255
268
  code: string;
@@ -263,9 +276,10 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
263
276
  success: boolean;
264
277
  error: undefined;
265
278
  };
279
+ meta: object;
266
280
  }>;
267
281
  }>>;
268
- messages: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
282
+ messages: _trpc_server.TRPCBuiltRouter<{
269
283
  ctx: {
270
284
  userId?: string;
271
285
  };
@@ -275,16 +289,16 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
275
289
  zodError: {
276
290
  errors: string[];
277
291
  } | null;
278
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_KEY;
292
+ code: _trpc_server.TRPC_ERROR_CODE_KEY;
279
293
  httpStatus: number;
280
294
  path?: string;
281
295
  stack?: string;
282
296
  };
283
297
  message: string;
284
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_NUMBER;
298
+ code: _trpc_server.TRPC_ERROR_CODE_NUMBER;
285
299
  };
286
300
  transformer: true;
287
- }, _trpc_server_unstable_core_do_not_import.DecorateCreateRouterOptions<{
301
+ }, _trpc_server.TRPCDecorateCreateRouterOptions<{
288
302
  get: _trpc_server.TRPCQueryProcedure<{
289
303
  input: {
290
304
  chatId: number;
@@ -303,6 +317,7 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
303
317
  message: null;
304
318
  error: "NOT_FOUND" | "DECRYPT_ERROR";
305
319
  };
320
+ meta: object;
306
321
  }>;
307
322
  add: _trpc_server.TRPCMutationProcedure<{
308
323
  input: {
@@ -317,9 +332,10 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
317
332
  output: {
318
333
  error: "ENCRYPT_ERROR" | null;
319
334
  };
335
+ meta: object;
320
336
  }>;
321
337
  }>>;
322
- auditLog: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
338
+ auditLog: _trpc_server.TRPCBuiltRouter<{
323
339
  ctx: {
324
340
  userId?: string;
325
341
  };
@@ -329,16 +345,16 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
329
345
  zodError: {
330
346
  errors: string[];
331
347
  } | null;
332
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_KEY;
348
+ code: _trpc_server.TRPC_ERROR_CODE_KEY;
333
349
  httpStatus: number;
334
350
  path?: string;
335
351
  stack?: string;
336
352
  };
337
353
  message: string;
338
- code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_NUMBER;
354
+ code: _trpc_server.TRPC_ERROR_CODE_NUMBER;
339
355
  };
340
356
  transformer: true;
341
- }, _trpc_server_unstable_core_do_not_import.DecorateCreateRouterOptions<{
357
+ }, _trpc_server.TRPCDecorateCreateRouterOptions<{
342
358
  create: _trpc_server.TRPCMutationProcedure<{
343
359
  input: {
344
360
  adminId: number;
@@ -349,6 +365,7 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
349
365
  reason?: string | undefined;
350
366
  };
351
367
  output: void;
368
+ meta: object;
352
369
  }>;
353
370
  getById: _trpc_server.TRPCQueryProcedure<{
354
371
  input: {
@@ -366,6 +383,7 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
366
383
  until: Date | null;
367
384
  reason: string | null;
368
385
  }[];
386
+ meta: object;
369
387
  }>;
370
388
  }>>;
371
389
  }>>;
@@ -415,11 +433,37 @@ declare const telegramPlugin: () => {
415
433
  returnHeaders?: ReturnHeaders | undefined;
416
434
  }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
417
435
  headers: Headers;
418
- response: better_auth.APIError | {
436
+ response: {
437
+ status: ("BAD_REQUEST" | "INTERNAL_SERVER_ERROR" | "NOT_IMPLEMENTED" | "BAD_GATEWAY" | "SERVICE_UNAVAILABLE" | "GATEWAY_TIMEOUT" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "CONFLICT" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "UNSUPPORTED_MEDIA_TYPE" | "TOO_MANY_REQUESTS" | "OK" | "CREATED" | "ACCEPTED" | "NO_CONTENT" | "MULTIPLE_CHOICES" | "MOVED_PERMANENTLY" | "FOUND" | "SEE_OTHER" | "NOT_MODIFIED" | "TEMPORARY_REDIRECT" | "METHOD_NOT_ALLOWED" | "NOT_ACCEPTABLE" | "PROXY_AUTHENTICATION_REQUIRED" | "REQUEST_TIMEOUT" | "GONE" | "LENGTH_REQUIRED" | "URI_TOO_LONG" | "RANGE_NOT_SATISFIABLE" | "EXPECTATION_FAILED" | "I'M_A_TEAPOT" | "MISDIRECTED_REQUEST" | "UNPROCESSABLE_ENTITY" | "LOCKED" | "FAILED_DEPENDENCY" | "TOO_EARLY" | "UPGRADE_REQUIRED" | "PRECONDITION_REQUIRED" | "REQUEST_HEADER_FIELDS_TOO_LARGE" | "UNAVAILABLE_FOR_LEGAL_REASONS" | "HTTP_VERSION_NOT_SUPPORTED" | "VARIANT_ALSO_NEGOTIATES" | "INSUFFICIENT_STORAGE" | "LOOP_DETECTED" | "NOT_EXTENDED" | "NETWORK_AUTHENTICATION_REQUIRED") | better_auth.Status;
438
+ body: ({
439
+ message?: string;
440
+ code?: string;
441
+ cause?: unknown;
442
+ } & Record<string, any>) | undefined;
443
+ headers: HeadersInit;
444
+ statusCode: number;
445
+ name: string;
446
+ message: string;
447
+ stack?: string;
448
+ cause?: unknown;
449
+ } | {
419
450
  code: string;
420
451
  ttl: number;
421
452
  };
422
- } : better_auth.APIError | {
453
+ } : {
454
+ status: ("BAD_REQUEST" | "INTERNAL_SERVER_ERROR" | "NOT_IMPLEMENTED" | "BAD_GATEWAY" | "SERVICE_UNAVAILABLE" | "GATEWAY_TIMEOUT" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "CONFLICT" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "UNSUPPORTED_MEDIA_TYPE" | "TOO_MANY_REQUESTS" | "OK" | "CREATED" | "ACCEPTED" | "NO_CONTENT" | "MULTIPLE_CHOICES" | "MOVED_PERMANENTLY" | "FOUND" | "SEE_OTHER" | "NOT_MODIFIED" | "TEMPORARY_REDIRECT" | "METHOD_NOT_ALLOWED" | "NOT_ACCEPTABLE" | "PROXY_AUTHENTICATION_REQUIRED" | "REQUEST_TIMEOUT" | "GONE" | "LENGTH_REQUIRED" | "URI_TOO_LONG" | "RANGE_NOT_SATISFIABLE" | "EXPECTATION_FAILED" | "I'M_A_TEAPOT" | "MISDIRECTED_REQUEST" | "UNPROCESSABLE_ENTITY" | "LOCKED" | "FAILED_DEPENDENCY" | "TOO_EARLY" | "UPGRADE_REQUIRED" | "PRECONDITION_REQUIRED" | "REQUEST_HEADER_FIELDS_TOO_LARGE" | "UNAVAILABLE_FOR_LEGAL_REASONS" | "HTTP_VERSION_NOT_SUPPORTED" | "VARIANT_ALSO_NEGOTIATES" | "INSUFFICIENT_STORAGE" | "LOOP_DETECTED" | "NOT_EXTENDED" | "NETWORK_AUTHENTICATION_REQUIRED") | better_auth.Status;
455
+ body: ({
456
+ message?: string;
457
+ code?: string;
458
+ cause?: unknown;
459
+ } & Record<string, any>) | undefined;
460
+ headers: HeadersInit;
461
+ statusCode: number;
462
+ name: string;
463
+ message: string;
464
+ stack?: string;
465
+ cause?: unknown;
466
+ } | {
423
467
  code: string;
424
468
  ttl: number;
425
469
  }>;
@@ -439,11 +483,11 @@ declare const telegramPlugin: () => {
439
483
  };
440
484
  user: Record<string, any> & {
441
485
  id: string;
442
- name: string;
443
- email: string;
444
- emailVerified: boolean;
445
486
  createdAt: Date;
446
487
  updatedAt: Date;
488
+ email: string;
489
+ emailVerified: boolean;
490
+ name: string;
447
491
  image?: string | null | undefined;
448
492
  };
449
493
  };
@@ -481,11 +525,37 @@ declare const telegramPlugin: () => {
481
525
  returnHeaders?: ReturnHeaders | undefined;
482
526
  }): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
483
527
  headers: Headers;
484
- response: better_auth.APIError | {
528
+ response: {
529
+ status: ("BAD_REQUEST" | "INTERNAL_SERVER_ERROR" | "NOT_IMPLEMENTED" | "BAD_GATEWAY" | "SERVICE_UNAVAILABLE" | "GATEWAY_TIMEOUT" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "CONFLICT" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "UNSUPPORTED_MEDIA_TYPE" | "TOO_MANY_REQUESTS" | "OK" | "CREATED" | "ACCEPTED" | "NO_CONTENT" | "MULTIPLE_CHOICES" | "MOVED_PERMANENTLY" | "FOUND" | "SEE_OTHER" | "NOT_MODIFIED" | "TEMPORARY_REDIRECT" | "METHOD_NOT_ALLOWED" | "NOT_ACCEPTABLE" | "PROXY_AUTHENTICATION_REQUIRED" | "REQUEST_TIMEOUT" | "GONE" | "LENGTH_REQUIRED" | "URI_TOO_LONG" | "RANGE_NOT_SATISFIABLE" | "EXPECTATION_FAILED" | "I'M_A_TEAPOT" | "MISDIRECTED_REQUEST" | "UNPROCESSABLE_ENTITY" | "LOCKED" | "FAILED_DEPENDENCY" | "TOO_EARLY" | "UPGRADE_REQUIRED" | "PRECONDITION_REQUIRED" | "REQUEST_HEADER_FIELDS_TOO_LARGE" | "UNAVAILABLE_FOR_LEGAL_REASONS" | "HTTP_VERSION_NOT_SUPPORTED" | "VARIANT_ALSO_NEGOTIATES" | "INSUFFICIENT_STORAGE" | "LOOP_DETECTED" | "NOT_EXTENDED" | "NETWORK_AUTHENTICATION_REQUIRED") | better_auth.Status;
530
+ body: ({
531
+ message?: string;
532
+ code?: string;
533
+ cause?: unknown;
534
+ } & Record<string, any>) | undefined;
535
+ headers: HeadersInit;
536
+ statusCode: number;
537
+ name: string;
538
+ message: string;
539
+ stack?: string;
540
+ cause?: unknown;
541
+ } | {
485
542
  expired: boolean;
486
543
  verified: boolean;
487
544
  };
488
- } : better_auth.APIError | {
545
+ } : {
546
+ status: ("BAD_REQUEST" | "INTERNAL_SERVER_ERROR" | "NOT_IMPLEMENTED" | "BAD_GATEWAY" | "SERVICE_UNAVAILABLE" | "GATEWAY_TIMEOUT" | "UNAUTHORIZED" | "PAYMENT_REQUIRED" | "FORBIDDEN" | "NOT_FOUND" | "CONFLICT" | "PRECONDITION_FAILED" | "PAYLOAD_TOO_LARGE" | "UNSUPPORTED_MEDIA_TYPE" | "TOO_MANY_REQUESTS" | "OK" | "CREATED" | "ACCEPTED" | "NO_CONTENT" | "MULTIPLE_CHOICES" | "MOVED_PERMANENTLY" | "FOUND" | "SEE_OTHER" | "NOT_MODIFIED" | "TEMPORARY_REDIRECT" | "METHOD_NOT_ALLOWED" | "NOT_ACCEPTABLE" | "PROXY_AUTHENTICATION_REQUIRED" | "REQUEST_TIMEOUT" | "GONE" | "LENGTH_REQUIRED" | "URI_TOO_LONG" | "RANGE_NOT_SATISFIABLE" | "EXPECTATION_FAILED" | "I'M_A_TEAPOT" | "MISDIRECTED_REQUEST" | "UNPROCESSABLE_ENTITY" | "LOCKED" | "FAILED_DEPENDENCY" | "TOO_EARLY" | "UPGRADE_REQUIRED" | "PRECONDITION_REQUIRED" | "REQUEST_HEADER_FIELDS_TOO_LARGE" | "UNAVAILABLE_FOR_LEGAL_REASONS" | "HTTP_VERSION_NOT_SUPPORTED" | "VARIANT_ALSO_NEGOTIATES" | "INSUFFICIENT_STORAGE" | "LOOP_DETECTED" | "NOT_EXTENDED" | "NETWORK_AUTHENTICATION_REQUIRED") | better_auth.Status;
547
+ body: ({
548
+ message?: string;
549
+ code?: string;
550
+ cause?: unknown;
551
+ } & Record<string, any>) | undefined;
552
+ headers: HeadersInit;
553
+ statusCode: number;
554
+ name: string;
555
+ message: string;
556
+ stack?: string;
557
+ cause?: unknown;
558
+ } | {
489
559
  expired: boolean;
490
560
  verified: boolean;
491
561
  }>;
@@ -505,11 +575,11 @@ declare const telegramPlugin: () => {
505
575
  };
506
576
  user: Record<string, any> & {
507
577
  id: string;
508
- name: string;
509
- email: string;
510
- emailVerified: boolean;
511
578
  createdAt: Date;
512
579
  updatedAt: Date;
580
+ email: string;
581
+ emailVerified: boolean;
582
+ name: string;
513
583
  image?: string | null | undefined;
514
584
  };
515
585
  };
@@ -525,6 +595,16 @@ declare const telegramPlugin: () => {
525
595
  };
526
596
  };
527
597
 
598
+ interface ToClient {
599
+ ban: (data: {
600
+ chatId: number;
601
+ userId: number;
602
+ durationInSeconds?: number;
603
+ }, cb: (error: string | null) => void) => void;
604
+ }
605
+ type ToServer = {};
606
+ type TelegramSocket = Socket<ToClient, ToServer>;
607
+
528
608
  type TelegramPlugin = typeof telegramPlugin;
529
609
 
530
- export { AUTH_PATH, type AppRouter, TRPC_PATH, type TelegramPlugin };
610
+ export { AUTH_PATH, type AppRouter, TRPC_PATH, type TelegramPlugin, type TelegramSocket, WS_PATH };
package/dist/index.js CHANGED
@@ -1,8 +1,10 @@
1
1
  // src/constants.ts
2
2
  var TRPC_PATH = "/api/trpc";
3
3
  var AUTH_PATH = "/api/auth";
4
+ var WS_PATH = "/ws";
4
5
  export {
5
6
  AUTH_PATH,
6
- TRPC_PATH
7
+ TRPC_PATH,
8
+ WS_PATH
7
9
  };
8
10
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/constants.ts"],"sourcesContent":["export const TRPC_PATH = \"/api/trpc\";\nexport const AUTH_PATH = \"/api/auth\";\n\nexport const TRUSTED_ORIGINS = [\n \"http://localhost:3001\",\n \"http://localhost:3002\",\n \"http://localhost:3003\",\n \"http://localhost:5173\",\n \"http://localhost:5174\",\n \"http://localhost:5175\",\n]\n\nexport const MESSAGES_RETENTION_DAYS = 7\n"],"mappings":";AAAO,IAAM,YAAY;AAClB,IAAM,YAAY;","names":[]}
1
+ {"version":3,"sources":["../src/constants.ts"],"sourcesContent":["export const TRPC_PATH = \"/api/trpc\"\nexport const AUTH_PATH = \"/api/auth\"\nexport const WS_PATH = \"/ws\"\n\nexport const TRUSTED_ORIGINS = [\n \"http://localhost:3001\",\n \"http://localhost:3002\",\n \"http://localhost:3003\",\n \"http://localhost:5173\",\n \"http://localhost:5174\",\n \"http://localhost:5175\",\n]\n\nexport const MESSAGES_RETENTION_DAYS = 7\n"],"mappings":";AAAO,IAAM,YAAY;AAClB,IAAM,YAAY;AAClB,IAAM,UAAU;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polinetwork/backend",
3
- "version": "0.9.1",
3
+ "version": "0.10.0",
4
4
  "description": "Utils to interact with the backend.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -30,12 +30,12 @@
30
30
  "devDependencies": {
31
31
  "copyfiles": "^2.4.1",
32
32
  "rimraf": "^6.0.1",
33
- "tsup": "^8.3.6",
34
- "typescript": "^4.9.4"
33
+ "tsup": "^8.5.0",
34
+ "typescript": "^5.9.2"
35
35
  },
36
36
  "engines": {
37
- "npm": ">=10.9.2",
38
- "node": ">=22.14.0"
37
+ "pnpm": ">=10.17.1",
38
+ "node": ">=24.8.0"
39
39
  },
40
40
  "scripts": {
41
41
  "build": "rimraf ./dist && cd ../backend && pnpm install && pnpm run build:npm && cd ../package && copyfiles -u 3 ../backend/lib/* dist"