@polinetwork/backend 0.9.2 → 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,9 +1,11 @@
1
1
  import * as _trpc_server from '@trpc/server';
2
2
  import * as better_auth from 'better-auth';
3
3
  import { z } from 'zod';
4
+ import { Socket } from 'socket.io-client';
4
5
 
5
6
  declare const TRPC_PATH = "/api/trpc";
6
7
  declare const AUTH_PATH = "/api/auth";
8
+ declare const WS_PATH = "/ws";
7
9
 
8
10
  declare const AUDIT_TYPE: {
9
11
  readonly BAN: "ban";
@@ -593,6 +595,16 @@ declare const telegramPlugin: () => {
593
595
  };
594
596
  };
595
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
+
596
608
  type TelegramPlugin = typeof telegramPlugin;
597
609
 
598
- 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,9 +1,11 @@
1
1
  import * as _trpc_server from '@trpc/server';
2
2
  import * as better_auth from 'better-auth';
3
3
  import { z } from 'zod';
4
+ import { Socket } from 'socket.io-client';
4
5
 
5
6
  declare const TRPC_PATH = "/api/trpc";
6
7
  declare const AUTH_PATH = "/api/auth";
8
+ declare const WS_PATH = "/ws";
7
9
 
8
10
  declare const AUDIT_TYPE: {
9
11
  readonly BAN: "ban";
@@ -593,6 +595,16 @@ declare const telegramPlugin: () => {
593
595
  };
594
596
  };
595
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
+
596
608
  type TelegramPlugin = typeof telegramPlugin;
597
609
 
598
- 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.2",
3
+ "version": "0.10.0",
4
4
  "description": "Utils to interact with the backend.",
5
5
  "repository": {
6
6
  "type": "git",