@polinetwork/backend 0.1.0 → 0.2.1

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.
@@ -30,4 +30,4 @@ var TRPC_PATH = "/api/trpc";
30
30
  0 && (module.exports = {
31
31
  TRPC_PATH
32
32
  });
33
- //# sourceMappingURL=index.js.map
33
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/constants.ts"],"sourcesContent":["export { TRPC_PATH } from \"./constants\"\nexport { type AppRouter } from \"./routers\"\n","export const TRPC_PATH = \"/api/trpc\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,YAAY;","names":[]}
@@ -0,0 +1,159 @@
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
+ import * as zod from 'zod';
4
+ import * as fastify_types_type_provider from 'fastify/types/type-provider';
5
+ import * as http from 'http';
6
+ import * as fastify from 'fastify';
7
+
8
+ declare const TRPC_PATH = "/api/trpc";
9
+
10
+ /**
11
+ * This is the primary router for your server.
12
+ *
13
+ * All routers added in /api/routers should be manually added here.
14
+ */
15
+ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
16
+ ctx: {
17
+ req: fastify.FastifyRequest<fastify.RouteGenericInterface, fastify.RawServerDefault, http.IncomingMessage, fastify.FastifySchema, fastify.FastifyTypeProviderDefault, unknown, fastify.FastifyBaseLogger, fastify_types_type_provider.ResolveFastifyRequestType<fastify.FastifyTypeProviderDefault, fastify.FastifySchema, fastify.RouteGenericInterface>>;
18
+ res: fastify.FastifyReply<fastify.RouteGenericInterface, fastify.RawServerDefault, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, unknown, fastify.FastifySchema, fastify.FastifyTypeProviderDefault, unknown>;
19
+ userId: string;
20
+ };
21
+ meta: object;
22
+ errorShape: {
23
+ data: {
24
+ zodError: zod.typeToFlattenedError<any, string> | null;
25
+ code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_KEY;
26
+ httpStatus: number;
27
+ path?: string;
28
+ stack?: string;
29
+ };
30
+ message: string;
31
+ code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_NUMBER;
32
+ };
33
+ transformer: false;
34
+ }, _trpc_server_unstable_core_do_not_import.DecorateCreateRouterOptions<{
35
+ test: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
36
+ ctx: {
37
+ req: fastify.FastifyRequest<fastify.RouteGenericInterface, fastify.RawServerDefault, http.IncomingMessage, fastify.FastifySchema, fastify.FastifyTypeProviderDefault, unknown, fastify.FastifyBaseLogger, fastify_types_type_provider.ResolveFastifyRequestType<fastify.FastifyTypeProviderDefault, fastify.FastifySchema, fastify.RouteGenericInterface>>;
38
+ res: fastify.FastifyReply<fastify.RouteGenericInterface, fastify.RawServerDefault, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, unknown, fastify.FastifySchema, fastify.FastifyTypeProviderDefault, unknown>;
39
+ userId: string;
40
+ };
41
+ meta: object;
42
+ errorShape: {
43
+ data: {
44
+ zodError: zod.typeToFlattenedError<any, string> | null;
45
+ code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_KEY;
46
+ httpStatus: number;
47
+ path?: string;
48
+ stack?: string;
49
+ };
50
+ message: string;
51
+ code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_NUMBER;
52
+ };
53
+ transformer: false;
54
+ }, _trpc_server_unstable_core_do_not_import.DecorateCreateRouterOptions<{
55
+ dbQuery: _trpc_server.TRPCQueryProcedure<{
56
+ input: {
57
+ dbName: "web" | "tg";
58
+ };
59
+ output: string[];
60
+ }>;
61
+ dbInsert: _trpc_server.TRPCMutationProcedure<{
62
+ input: {
63
+ text: string;
64
+ dbName: "web" | "tg";
65
+ };
66
+ output: boolean;
67
+ }>;
68
+ }>>;
69
+ tg: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
70
+ ctx: {
71
+ req: fastify.FastifyRequest<fastify.RouteGenericInterface, fastify.RawServerDefault, http.IncomingMessage, fastify.FastifySchema, fastify.FastifyTypeProviderDefault, unknown, fastify.FastifyBaseLogger, fastify_types_type_provider.ResolveFastifyRequestType<fastify.FastifyTypeProviderDefault, fastify.FastifySchema, fastify.RouteGenericInterface>>;
72
+ res: fastify.FastifyReply<fastify.RouteGenericInterface, fastify.RawServerDefault, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, unknown, fastify.FastifySchema, fastify.FastifyTypeProviderDefault, unknown>;
73
+ userId: string;
74
+ };
75
+ meta: object;
76
+ errorShape: {
77
+ data: {
78
+ zodError: zod.typeToFlattenedError<any, string> | null;
79
+ code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_KEY;
80
+ httpStatus: number;
81
+ path?: string;
82
+ stack?: string;
83
+ };
84
+ message: string;
85
+ code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_NUMBER;
86
+ };
87
+ transformer: false;
88
+ }, _trpc_server_unstable_core_do_not_import.DecorateCreateRouterOptions<{
89
+ groups: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
90
+ ctx: {
91
+ req: fastify.FastifyRequest<fastify.RouteGenericInterface, fastify.RawServerDefault, http.IncomingMessage, fastify.FastifySchema, fastify.FastifyTypeProviderDefault, unknown, fastify.FastifyBaseLogger, fastify_types_type_provider.ResolveFastifyRequestType<fastify.FastifyTypeProviderDefault, fastify.FastifySchema, fastify.RouteGenericInterface>>;
92
+ res: fastify.FastifyReply<fastify.RouteGenericInterface, fastify.RawServerDefault, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, unknown, fastify.FastifySchema, fastify.FastifyTypeProviderDefault, unknown>;
93
+ userId: string;
94
+ };
95
+ meta: object;
96
+ errorShape: {
97
+ data: {
98
+ zodError: zod.typeToFlattenedError<any, string> | null;
99
+ code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_KEY;
100
+ httpStatus: number;
101
+ path?: string;
102
+ stack?: string;
103
+ };
104
+ message: string;
105
+ code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_NUMBER;
106
+ };
107
+ transformer: false;
108
+ }, _trpc_server_unstable_core_do_not_import.DecorateCreateRouterOptions<{
109
+ getAll: _trpc_server.TRPCQueryProcedure<{
110
+ input: void;
111
+ output: {
112
+ updatedAt: Date | null;
113
+ createdAt: Date;
114
+ id: number;
115
+ telegramId: number;
116
+ title: string;
117
+ link: string | null;
118
+ }[];
119
+ }>;
120
+ search: _trpc_server.TRPCQueryProcedure<{
121
+ input: {
122
+ query: string;
123
+ };
124
+ output: {
125
+ link: string | null;
126
+ id: number;
127
+ telegramId: number;
128
+ title: string;
129
+ updatedAt: Date | null;
130
+ createdAt: Date;
131
+ }[];
132
+ }>;
133
+ getById: _trpc_server.TRPCQueryProcedure<{
134
+ input: {
135
+ telegramId: number;
136
+ };
137
+ output: {
138
+ link: string | null;
139
+ id: number;
140
+ telegramId: number;
141
+ title: string;
142
+ updatedAt: Date | null;
143
+ createdAt: Date;
144
+ } | undefined;
145
+ }>;
146
+ create: _trpc_server.TRPCMutationProcedure<{
147
+ input: {
148
+ link: string;
149
+ telegramId: number;
150
+ title: string;
151
+ }[];
152
+ output: number[];
153
+ }>;
154
+ }>>;
155
+ }>>;
156
+ }>>;
157
+ type AppRouter = typeof appRouter;
158
+
159
+ export { type AppRouter, TRPC_PATH };
@@ -0,0 +1,159 @@
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
+ import * as zod from 'zod';
4
+ import * as fastify_types_type_provider from 'fastify/types/type-provider';
5
+ import * as http from 'http';
6
+ import * as fastify from 'fastify';
7
+
8
+ declare const TRPC_PATH = "/api/trpc";
9
+
10
+ /**
11
+ * This is the primary router for your server.
12
+ *
13
+ * All routers added in /api/routers should be manually added here.
14
+ */
15
+ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
16
+ ctx: {
17
+ req: fastify.FastifyRequest<fastify.RouteGenericInterface, fastify.RawServerDefault, http.IncomingMessage, fastify.FastifySchema, fastify.FastifyTypeProviderDefault, unknown, fastify.FastifyBaseLogger, fastify_types_type_provider.ResolveFastifyRequestType<fastify.FastifyTypeProviderDefault, fastify.FastifySchema, fastify.RouteGenericInterface>>;
18
+ res: fastify.FastifyReply<fastify.RouteGenericInterface, fastify.RawServerDefault, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, unknown, fastify.FastifySchema, fastify.FastifyTypeProviderDefault, unknown>;
19
+ userId: string;
20
+ };
21
+ meta: object;
22
+ errorShape: {
23
+ data: {
24
+ zodError: zod.typeToFlattenedError<any, string> | null;
25
+ code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_KEY;
26
+ httpStatus: number;
27
+ path?: string;
28
+ stack?: string;
29
+ };
30
+ message: string;
31
+ code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_NUMBER;
32
+ };
33
+ transformer: false;
34
+ }, _trpc_server_unstable_core_do_not_import.DecorateCreateRouterOptions<{
35
+ test: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
36
+ ctx: {
37
+ req: fastify.FastifyRequest<fastify.RouteGenericInterface, fastify.RawServerDefault, http.IncomingMessage, fastify.FastifySchema, fastify.FastifyTypeProviderDefault, unknown, fastify.FastifyBaseLogger, fastify_types_type_provider.ResolveFastifyRequestType<fastify.FastifyTypeProviderDefault, fastify.FastifySchema, fastify.RouteGenericInterface>>;
38
+ res: fastify.FastifyReply<fastify.RouteGenericInterface, fastify.RawServerDefault, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, unknown, fastify.FastifySchema, fastify.FastifyTypeProviderDefault, unknown>;
39
+ userId: string;
40
+ };
41
+ meta: object;
42
+ errorShape: {
43
+ data: {
44
+ zodError: zod.typeToFlattenedError<any, string> | null;
45
+ code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_KEY;
46
+ httpStatus: number;
47
+ path?: string;
48
+ stack?: string;
49
+ };
50
+ message: string;
51
+ code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_NUMBER;
52
+ };
53
+ transformer: false;
54
+ }, _trpc_server_unstable_core_do_not_import.DecorateCreateRouterOptions<{
55
+ dbQuery: _trpc_server.TRPCQueryProcedure<{
56
+ input: {
57
+ dbName: "web" | "tg";
58
+ };
59
+ output: string[];
60
+ }>;
61
+ dbInsert: _trpc_server.TRPCMutationProcedure<{
62
+ input: {
63
+ text: string;
64
+ dbName: "web" | "tg";
65
+ };
66
+ output: boolean;
67
+ }>;
68
+ }>>;
69
+ tg: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
70
+ ctx: {
71
+ req: fastify.FastifyRequest<fastify.RouteGenericInterface, fastify.RawServerDefault, http.IncomingMessage, fastify.FastifySchema, fastify.FastifyTypeProviderDefault, unknown, fastify.FastifyBaseLogger, fastify_types_type_provider.ResolveFastifyRequestType<fastify.FastifyTypeProviderDefault, fastify.FastifySchema, fastify.RouteGenericInterface>>;
72
+ res: fastify.FastifyReply<fastify.RouteGenericInterface, fastify.RawServerDefault, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, unknown, fastify.FastifySchema, fastify.FastifyTypeProviderDefault, unknown>;
73
+ userId: string;
74
+ };
75
+ meta: object;
76
+ errorShape: {
77
+ data: {
78
+ zodError: zod.typeToFlattenedError<any, string> | null;
79
+ code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_KEY;
80
+ httpStatus: number;
81
+ path?: string;
82
+ stack?: string;
83
+ };
84
+ message: string;
85
+ code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_NUMBER;
86
+ };
87
+ transformer: false;
88
+ }, _trpc_server_unstable_core_do_not_import.DecorateCreateRouterOptions<{
89
+ groups: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
90
+ ctx: {
91
+ req: fastify.FastifyRequest<fastify.RouteGenericInterface, fastify.RawServerDefault, http.IncomingMessage, fastify.FastifySchema, fastify.FastifyTypeProviderDefault, unknown, fastify.FastifyBaseLogger, fastify_types_type_provider.ResolveFastifyRequestType<fastify.FastifyTypeProviderDefault, fastify.FastifySchema, fastify.RouteGenericInterface>>;
92
+ res: fastify.FastifyReply<fastify.RouteGenericInterface, fastify.RawServerDefault, http.IncomingMessage, http.ServerResponse<http.IncomingMessage>, unknown, fastify.FastifySchema, fastify.FastifyTypeProviderDefault, unknown>;
93
+ userId: string;
94
+ };
95
+ meta: object;
96
+ errorShape: {
97
+ data: {
98
+ zodError: zod.typeToFlattenedError<any, string> | null;
99
+ code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_KEY;
100
+ httpStatus: number;
101
+ path?: string;
102
+ stack?: string;
103
+ };
104
+ message: string;
105
+ code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_NUMBER;
106
+ };
107
+ transformer: false;
108
+ }, _trpc_server_unstable_core_do_not_import.DecorateCreateRouterOptions<{
109
+ getAll: _trpc_server.TRPCQueryProcedure<{
110
+ input: void;
111
+ output: {
112
+ updatedAt: Date | null;
113
+ createdAt: Date;
114
+ id: number;
115
+ telegramId: number;
116
+ title: string;
117
+ link: string | null;
118
+ }[];
119
+ }>;
120
+ search: _trpc_server.TRPCQueryProcedure<{
121
+ input: {
122
+ query: string;
123
+ };
124
+ output: {
125
+ link: string | null;
126
+ id: number;
127
+ telegramId: number;
128
+ title: string;
129
+ updatedAt: Date | null;
130
+ createdAt: Date;
131
+ }[];
132
+ }>;
133
+ getById: _trpc_server.TRPCQueryProcedure<{
134
+ input: {
135
+ telegramId: number;
136
+ };
137
+ output: {
138
+ link: string | null;
139
+ id: number;
140
+ telegramId: number;
141
+ title: string;
142
+ updatedAt: Date | null;
143
+ createdAt: Date;
144
+ } | undefined;
145
+ }>;
146
+ create: _trpc_server.TRPCMutationProcedure<{
147
+ input: {
148
+ link: string;
149
+ telegramId: number;
150
+ title: string;
151
+ }[];
152
+ output: number[];
153
+ }>;
154
+ }>>;
155
+ }>>;
156
+ }>>;
157
+ type AppRouter = typeof appRouter;
158
+
159
+ export { type AppRouter, TRPC_PATH };
@@ -3,4 +3,4 @@ var TRPC_PATH = "/api/trpc";
3
3
  export {
4
4
  TRPC_PATH
5
5
  };
6
- //# sourceMappingURL=index.mjs.map
6
+ //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,33 +1,30 @@
1
1
  {
2
2
  "name": "@polinetwork/backend",
3
- "version": "0.1.0",
4
- "description": "PoliNetwork backend server",
5
- "main": "lib/index.js",
6
- "types": "lib/index.d.ts",
7
- "module": "lib/index.esm.js",
8
- "files": [
9
- "lib"
10
- ],
11
- "private": false,
3
+ "version": "0.2.1",
4
+ "description": "Utils to interact with the backend.",
12
5
  "keywords": [],
13
6
  "author": "PoliNetwork APS",
14
7
  "license": "ISC",
8
+ "main": "dist/index.cjs",
9
+ "types": "dist/index.d.ts",
10
+ "module": "dist/index.js",
11
+ "files": [
12
+ "dist"
13
+ ],
14
+ "exports": {
15
+ ".": {
16
+ "require": "./dist/index.cjs",
17
+ "import": "./dist/index.js",
18
+ "types": "./dist/index.d.ts"
19
+ }
20
+ },
15
21
  "devDependencies": {
16
- "@types/node": "^22.13.1",
17
- "tsc-alias": "^1.8.10",
22
+ "copyfiles": "^2.4.1",
23
+ "rimraf": "^6.0.1",
18
24
  "tsup": "^8.3.6",
19
- "tsx": "^4.19.2",
20
- "typescript": "^5.7.3"
21
- },
22
- "dependencies": {
23
- "@trpc/server": "^10.45.2",
24
- "fastify": "^5.2.1",
25
- "zod": "^3.24.1"
25
+ "typescript": "^4.9.4"
26
26
  },
27
27
  "scripts": {
28
- "build:server": "NODE_ENV=production tsc",
29
- "build:npm": "NODE_ENV=production tsup",
30
- "dev": "NODE_ENV=development tsx watch src/server.ts",
31
- "start": "NODE_ENV=production node dist/index.js"
28
+ "build": "rimraf ./dist && cd ../backend && pnpm install && pnpm run build:npm && cd ../package && copyfiles -u 3 ../backend/lib/* dist"
32
29
  }
33
30
  }
package/README.md DELETED
@@ -1,8 +0,0 @@
1
- # Backend
2
-
3
- > [!NOTE]
4
- > ### WIP
5
- > This is a rewrite currently WIP that will take time. Drink a coffee and join us if you would like to contribute.
6
-
7
- Currently we are building a backend which can be reached by other services/repos with a tRPC client.
8
- If you are using another language than TS... then you might fullfil a PR and implement gRPC (are you sure u want pain?).
package/lib/index.d.mts DELETED
@@ -1,28 +0,0 @@
1
- import * as _trpc_server from '@trpc/server';
2
-
3
- declare const TRPC_PATH = "/api/trpc";
4
-
5
- declare const appRouter: _trpc_server.CreateRouterInner<_trpc_server.RootConfig<{
6
- ctx: object;
7
- meta: object;
8
- errorShape: _trpc_server.DefaultErrorShape;
9
- transformer: _trpc_server.DefaultDataTransformer;
10
- }>, {
11
- add: _trpc_server.BuildProcedure<"query", {
12
- _config: _trpc_server.RootConfig<{
13
- ctx: object;
14
- meta: object;
15
- errorShape: _trpc_server.DefaultErrorShape;
16
- transformer: _trpc_server.DefaultDataTransformer;
17
- }>;
18
- _meta: object;
19
- _ctx_out: object;
20
- _input_in: number[];
21
- _input_out: number[];
22
- _output_in: typeof _trpc_server.unsetMarker;
23
- _output_out: typeof _trpc_server.unsetMarker;
24
- }, number>;
25
- }>;
26
- type AppRouter = typeof appRouter;
27
-
28
- export { type AppRouter, TRPC_PATH };
package/lib/index.d.ts DELETED
@@ -1,28 +0,0 @@
1
- import * as _trpc_server from '@trpc/server';
2
-
3
- declare const TRPC_PATH = "/api/trpc";
4
-
5
- declare const appRouter: _trpc_server.CreateRouterInner<_trpc_server.RootConfig<{
6
- ctx: object;
7
- meta: object;
8
- errorShape: _trpc_server.DefaultErrorShape;
9
- transformer: _trpc_server.DefaultDataTransformer;
10
- }>, {
11
- add: _trpc_server.BuildProcedure<"query", {
12
- _config: _trpc_server.RootConfig<{
13
- ctx: object;
14
- meta: object;
15
- errorShape: _trpc_server.DefaultErrorShape;
16
- transformer: _trpc_server.DefaultDataTransformer;
17
- }>;
18
- _meta: object;
19
- _ctx_out: object;
20
- _input_in: number[];
21
- _input_out: number[];
22
- _output_in: typeof _trpc_server.unsetMarker;
23
- _output_out: typeof _trpc_server.unsetMarker;
24
- }, number>;
25
- }>;
26
- type AppRouter = typeof appRouter;
27
-
28
- export { type AppRouter, TRPC_PATH };
@@ -1,6 +0,0 @@
1
- "use strict";
2
- (() => {
3
- // src/constants.ts
4
- var TRPC_PATH = "/api/trpc";
5
- })();
6
- //# sourceMappingURL=index.global.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/constants.ts"],"sourcesContent":["export const TRPC_PATH = \"/api/trpc\";\n"],"mappings":";;;AAAO,MAAM,YAAY;","names":[]}
package/lib/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/index.ts","../src/constants.ts"],"sourcesContent":["export { TRPC_PATH } from \"./constants\"\nexport { type AppRouter } from \"./router\"\n","export const TRPC_PATH = \"/api/trpc\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,YAAY;","names":[]}
File without changes