@polinetwork/backend 0.4.1 → 0.5.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.
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +132 -1
- package/dist/index.d.ts +132 -1
- package/package.json +1 -1
package/dist/index.cjs.map
CHANGED
|
@@ -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\"\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"],"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 { 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"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAO,IAAM,YAAY;AAClB,IAAM,YAAY;","names":[]}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as _trpc_server from '@trpc/server';
|
|
2
2
|
import * as _trpc_server_unstable_core_do_not_import from '@trpc/server/unstable-core-do-not-import';
|
|
3
3
|
import * as zod from 'zod';
|
|
4
|
+
import * as better_auth from 'better-auth';
|
|
4
5
|
|
|
5
6
|
declare const TRPC_PATH = "/api/trpc";
|
|
6
7
|
declare const AUTH_PATH = "/api/auth";
|
|
@@ -193,8 +194,138 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
|
|
|
193
194
|
output: void;
|
|
194
195
|
}>;
|
|
195
196
|
}>>;
|
|
197
|
+
link: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
|
|
198
|
+
ctx: {
|
|
199
|
+
userId?: string;
|
|
200
|
+
};
|
|
201
|
+
meta: object;
|
|
202
|
+
errorShape: {
|
|
203
|
+
data: {
|
|
204
|
+
zodError: zod.typeToFlattenedError<any, string> | null;
|
|
205
|
+
code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_KEY;
|
|
206
|
+
httpStatus: number;
|
|
207
|
+
path?: string;
|
|
208
|
+
stack?: string;
|
|
209
|
+
};
|
|
210
|
+
message: string;
|
|
211
|
+
code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_NUMBER;
|
|
212
|
+
};
|
|
213
|
+
transformer: false;
|
|
214
|
+
}, _trpc_server_unstable_core_do_not_import.DecorateCreateRouterOptions<{
|
|
215
|
+
link: _trpc_server.TRPCQueryProcedure<{
|
|
216
|
+
input: {
|
|
217
|
+
telegramId: number;
|
|
218
|
+
telegramUsername: string;
|
|
219
|
+
code: string;
|
|
220
|
+
};
|
|
221
|
+
output: {
|
|
222
|
+
success: boolean;
|
|
223
|
+
};
|
|
224
|
+
}>;
|
|
225
|
+
}>>;
|
|
196
226
|
}>>;
|
|
197
227
|
}>>;
|
|
198
228
|
type AppRouter = typeof appRouter;
|
|
199
229
|
|
|
200
|
-
|
|
230
|
+
declare const telegramPlugin: () => {
|
|
231
|
+
id: "telegram";
|
|
232
|
+
schema: {
|
|
233
|
+
user: {
|
|
234
|
+
fields: {
|
|
235
|
+
telegramId: {
|
|
236
|
+
type: "number";
|
|
237
|
+
required: false;
|
|
238
|
+
unique: true;
|
|
239
|
+
};
|
|
240
|
+
telegramUsername: {
|
|
241
|
+
type: "string";
|
|
242
|
+
required: false;
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
};
|
|
246
|
+
};
|
|
247
|
+
endpoints: {
|
|
248
|
+
startLink: {
|
|
249
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
|
|
250
|
+
body?: undefined;
|
|
251
|
+
} & {
|
|
252
|
+
method?: "POST" | undefined;
|
|
253
|
+
} & {
|
|
254
|
+
query?: Record<string, any> | undefined;
|
|
255
|
+
} & {
|
|
256
|
+
params?: Record<string, any>;
|
|
257
|
+
} & {
|
|
258
|
+
request?: Request;
|
|
259
|
+
} & {
|
|
260
|
+
headers?: HeadersInit;
|
|
261
|
+
} & {
|
|
262
|
+
asResponse?: boolean;
|
|
263
|
+
returnHeaders?: boolean;
|
|
264
|
+
use?: better_auth.Middleware[];
|
|
265
|
+
path?: string;
|
|
266
|
+
} & {
|
|
267
|
+
asResponse?: AsResponse | undefined;
|
|
268
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
269
|
+
}) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
270
|
+
headers: Headers;
|
|
271
|
+
response: better_auth.APIError | {
|
|
272
|
+
code: string;
|
|
273
|
+
ttl: number;
|
|
274
|
+
};
|
|
275
|
+
} : better_auth.APIError | {
|
|
276
|
+
code: string;
|
|
277
|
+
ttl: number;
|
|
278
|
+
}>;
|
|
279
|
+
options: {
|
|
280
|
+
method: "POST";
|
|
281
|
+
} & {
|
|
282
|
+
use: any[];
|
|
283
|
+
};
|
|
284
|
+
path: "/telegram/link/start";
|
|
285
|
+
};
|
|
286
|
+
verifyLink: {
|
|
287
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
|
|
288
|
+
body?: undefined;
|
|
289
|
+
} & {
|
|
290
|
+
method?: "GET" | undefined;
|
|
291
|
+
} & {
|
|
292
|
+
query?: Record<string, any> | undefined;
|
|
293
|
+
} & {
|
|
294
|
+
params: {
|
|
295
|
+
code: string;
|
|
296
|
+
};
|
|
297
|
+
} & {
|
|
298
|
+
request?: Request;
|
|
299
|
+
} & {
|
|
300
|
+
headers?: HeadersInit;
|
|
301
|
+
} & {
|
|
302
|
+
asResponse?: boolean;
|
|
303
|
+
returnHeaders?: boolean;
|
|
304
|
+
use?: better_auth.Middleware[];
|
|
305
|
+
path?: string;
|
|
306
|
+
} & {
|
|
307
|
+
asResponse?: AsResponse | undefined;
|
|
308
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
309
|
+
}): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
310
|
+
headers: Headers;
|
|
311
|
+
response: better_auth.APIError | {
|
|
312
|
+
expired: boolean;
|
|
313
|
+
verified: boolean;
|
|
314
|
+
};
|
|
315
|
+
} : better_auth.APIError | {
|
|
316
|
+
expired: boolean;
|
|
317
|
+
verified: boolean;
|
|
318
|
+
}>;
|
|
319
|
+
options: {
|
|
320
|
+
method: "GET";
|
|
321
|
+
} & {
|
|
322
|
+
use: any[];
|
|
323
|
+
};
|
|
324
|
+
path: "/telegram/link/verify/:code";
|
|
325
|
+
};
|
|
326
|
+
};
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
type TelegramPlugin = typeof telegramPlugin;
|
|
330
|
+
|
|
331
|
+
export { AUTH_PATH, type AppRouter, TRPC_PATH, type TelegramPlugin };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as _trpc_server from '@trpc/server';
|
|
2
2
|
import * as _trpc_server_unstable_core_do_not_import from '@trpc/server/unstable-core-do-not-import';
|
|
3
3
|
import * as zod from 'zod';
|
|
4
|
+
import * as better_auth from 'better-auth';
|
|
4
5
|
|
|
5
6
|
declare const TRPC_PATH = "/api/trpc";
|
|
6
7
|
declare const AUTH_PATH = "/api/auth";
|
|
@@ -193,8 +194,138 @@ declare const appRouter: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
|
|
|
193
194
|
output: void;
|
|
194
195
|
}>;
|
|
195
196
|
}>>;
|
|
197
|
+
link: _trpc_server_unstable_core_do_not_import.BuiltRouter<{
|
|
198
|
+
ctx: {
|
|
199
|
+
userId?: string;
|
|
200
|
+
};
|
|
201
|
+
meta: object;
|
|
202
|
+
errorShape: {
|
|
203
|
+
data: {
|
|
204
|
+
zodError: zod.typeToFlattenedError<any, string> | null;
|
|
205
|
+
code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_KEY;
|
|
206
|
+
httpStatus: number;
|
|
207
|
+
path?: string;
|
|
208
|
+
stack?: string;
|
|
209
|
+
};
|
|
210
|
+
message: string;
|
|
211
|
+
code: _trpc_server_unstable_core_do_not_import.TRPC_ERROR_CODE_NUMBER;
|
|
212
|
+
};
|
|
213
|
+
transformer: false;
|
|
214
|
+
}, _trpc_server_unstable_core_do_not_import.DecorateCreateRouterOptions<{
|
|
215
|
+
link: _trpc_server.TRPCQueryProcedure<{
|
|
216
|
+
input: {
|
|
217
|
+
telegramId: number;
|
|
218
|
+
telegramUsername: string;
|
|
219
|
+
code: string;
|
|
220
|
+
};
|
|
221
|
+
output: {
|
|
222
|
+
success: boolean;
|
|
223
|
+
};
|
|
224
|
+
}>;
|
|
225
|
+
}>>;
|
|
196
226
|
}>>;
|
|
197
227
|
}>>;
|
|
198
228
|
type AppRouter = typeof appRouter;
|
|
199
229
|
|
|
200
|
-
|
|
230
|
+
declare const telegramPlugin: () => {
|
|
231
|
+
id: "telegram";
|
|
232
|
+
schema: {
|
|
233
|
+
user: {
|
|
234
|
+
fields: {
|
|
235
|
+
telegramId: {
|
|
236
|
+
type: "number";
|
|
237
|
+
required: false;
|
|
238
|
+
unique: true;
|
|
239
|
+
};
|
|
240
|
+
telegramUsername: {
|
|
241
|
+
type: "string";
|
|
242
|
+
required: false;
|
|
243
|
+
};
|
|
244
|
+
};
|
|
245
|
+
};
|
|
246
|
+
};
|
|
247
|
+
endpoints: {
|
|
248
|
+
startLink: {
|
|
249
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0?: ({
|
|
250
|
+
body?: undefined;
|
|
251
|
+
} & {
|
|
252
|
+
method?: "POST" | undefined;
|
|
253
|
+
} & {
|
|
254
|
+
query?: Record<string, any> | undefined;
|
|
255
|
+
} & {
|
|
256
|
+
params?: Record<string, any>;
|
|
257
|
+
} & {
|
|
258
|
+
request?: Request;
|
|
259
|
+
} & {
|
|
260
|
+
headers?: HeadersInit;
|
|
261
|
+
} & {
|
|
262
|
+
asResponse?: boolean;
|
|
263
|
+
returnHeaders?: boolean;
|
|
264
|
+
use?: better_auth.Middleware[];
|
|
265
|
+
path?: string;
|
|
266
|
+
} & {
|
|
267
|
+
asResponse?: AsResponse | undefined;
|
|
268
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
269
|
+
}) | undefined): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
270
|
+
headers: Headers;
|
|
271
|
+
response: better_auth.APIError | {
|
|
272
|
+
code: string;
|
|
273
|
+
ttl: number;
|
|
274
|
+
};
|
|
275
|
+
} : better_auth.APIError | {
|
|
276
|
+
code: string;
|
|
277
|
+
ttl: number;
|
|
278
|
+
}>;
|
|
279
|
+
options: {
|
|
280
|
+
method: "POST";
|
|
281
|
+
} & {
|
|
282
|
+
use: any[];
|
|
283
|
+
};
|
|
284
|
+
path: "/telegram/link/start";
|
|
285
|
+
};
|
|
286
|
+
verifyLink: {
|
|
287
|
+
<AsResponse extends boolean = false, ReturnHeaders extends boolean = false>(inputCtx_0: {
|
|
288
|
+
body?: undefined;
|
|
289
|
+
} & {
|
|
290
|
+
method?: "GET" | undefined;
|
|
291
|
+
} & {
|
|
292
|
+
query?: Record<string, any> | undefined;
|
|
293
|
+
} & {
|
|
294
|
+
params: {
|
|
295
|
+
code: string;
|
|
296
|
+
};
|
|
297
|
+
} & {
|
|
298
|
+
request?: Request;
|
|
299
|
+
} & {
|
|
300
|
+
headers?: HeadersInit;
|
|
301
|
+
} & {
|
|
302
|
+
asResponse?: boolean;
|
|
303
|
+
returnHeaders?: boolean;
|
|
304
|
+
use?: better_auth.Middleware[];
|
|
305
|
+
path?: string;
|
|
306
|
+
} & {
|
|
307
|
+
asResponse?: AsResponse | undefined;
|
|
308
|
+
returnHeaders?: ReturnHeaders | undefined;
|
|
309
|
+
}): Promise<[AsResponse] extends [true] ? Response : [ReturnHeaders] extends [true] ? {
|
|
310
|
+
headers: Headers;
|
|
311
|
+
response: better_auth.APIError | {
|
|
312
|
+
expired: boolean;
|
|
313
|
+
verified: boolean;
|
|
314
|
+
};
|
|
315
|
+
} : better_auth.APIError | {
|
|
316
|
+
expired: boolean;
|
|
317
|
+
verified: boolean;
|
|
318
|
+
}>;
|
|
319
|
+
options: {
|
|
320
|
+
method: "GET";
|
|
321
|
+
} & {
|
|
322
|
+
use: any[];
|
|
323
|
+
};
|
|
324
|
+
path: "/telegram/link/verify/:code";
|
|
325
|
+
};
|
|
326
|
+
};
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
type TelegramPlugin = typeof telegramPlugin;
|
|
330
|
+
|
|
331
|
+
export { AUTH_PATH, type AppRouter, TRPC_PATH, type TelegramPlugin };
|