@goatlab/node-backend 1.2.0 → 1.3.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/cache/LazyRedisStore.d.ts +0 -5
- package/dist/cache/LazyRedisStore.js +0 -7
- package/dist/cache/LazyRedisStore.js.map +1 -1
- package/dist/container/Container.d.ts +45 -13
- package/dist/container/Container.js +260 -140
- package/dist/container/Container.js.map +1 -1
- package/dist/container/types.d.ts +70 -0
- package/dist/container/types.js +20 -0
- package/dist/container/types.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/server/bootstraps/ExpressTrpcAppConfig.d.ts +12 -0
- package/dist/server/bootstraps/ExpressTrpcAppConfig.js +1 -0
- package/dist/server/bootstraps/ExpressTrpcAppConfig.js.map +1 -1
- package/dist/server/bootstraps/getExpressTrpcApp.js +2 -2
- package/dist/server/bootstraps/getExpressTrpcApp.js.map +1 -1
- package/dist/server/middleware/logs.middleware.d.ts +6 -1
- package/dist/server/middleware/logs.middleware.js +10 -4
- package/dist/server/middleware/logs.middleware.js.map +1 -1
- package/dist/server/trpc.d.ts +49 -8
- package/dist/server/trpc.js +1 -0
- package/dist/server/trpc.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
package/dist/server/trpc.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
|
+
import type { DefaultErrorShape, ErrorFormatter } from '@trpc/server/unstable-core-do-not-import';
|
|
1
2
|
import type { OpenApiMeta } from 'trpc-to-openapi';
|
|
2
3
|
import type { TrpcContext } from './context/trpc.context';
|
|
3
4
|
import { DecodedUserToken } from './schemas/user.schema';
|
|
4
5
|
export declare function getTrpc<ExtendedAuthenticatedContext = Record<string, unknown>, ExtendedContext = Record<string, unknown>>(params?: {
|
|
6
|
+
/** Extend authenticated context with additional data (e.g., account context) */
|
|
5
7
|
extendAuthenticatedContext?: (user: DecodedUserToken) => ExtendedAuthenticatedContext;
|
|
8
|
+
/** Extend base context (runs for all requests) - use for tenant services, etc. */
|
|
6
9
|
extendContext?: (ctx: TrpcContext) => Promise<ExtendedContext>;
|
|
10
|
+
/** Custom error formatter for tRPC errors */
|
|
11
|
+
errorFormatter?: ErrorFormatter<TrpcContext, DefaultErrorShape>;
|
|
7
12
|
}): {
|
|
8
13
|
authenticatedEndpoint: import("@trpc/server").TRPCProcedureBuilder<{
|
|
9
14
|
user: {
|
|
@@ -41,6 +46,8 @@ export declare function getTrpc<ExtendedAuthenticatedContext = Record<string, un
|
|
|
41
46
|
isAndroid: boolean;
|
|
42
47
|
};
|
|
43
48
|
}, OpenApiMeta, {
|
|
49
|
+
method: string;
|
|
50
|
+
url: string;
|
|
44
51
|
origin: string;
|
|
45
52
|
ip: string;
|
|
46
53
|
user: {
|
|
@@ -62,8 +69,6 @@ export declare function getTrpc<ExtendedAuthenticatedContext = Record<string, un
|
|
|
62
69
|
email: string;
|
|
63
70
|
userId: string;
|
|
64
71
|
};
|
|
65
|
-
method: string;
|
|
66
|
-
url: string;
|
|
67
72
|
xTenantId: string;
|
|
68
73
|
getLocation: () => Promise<import("..").LocationOutput>;
|
|
69
74
|
endpoint: string;
|
|
@@ -114,6 +119,8 @@ export declare function getTrpc<ExtendedAuthenticatedContext = Record<string, un
|
|
|
114
119
|
isAndroid: boolean;
|
|
115
120
|
};
|
|
116
121
|
}, OpenApiMeta, {
|
|
122
|
+
method: string;
|
|
123
|
+
url: string;
|
|
117
124
|
origin: string;
|
|
118
125
|
ip: string;
|
|
119
126
|
user: {
|
|
@@ -135,8 +142,6 @@ export declare function getTrpc<ExtendedAuthenticatedContext = Record<string, un
|
|
|
135
142
|
email: string;
|
|
136
143
|
userId: string;
|
|
137
144
|
};
|
|
138
|
-
method: string;
|
|
139
|
-
url: string;
|
|
140
145
|
xTenantId: string;
|
|
141
146
|
getLocation: () => Promise<import("..").LocationOutput>;
|
|
142
147
|
endpoint: string;
|
|
@@ -188,6 +193,8 @@ export declare function getTrpc<ExtendedAuthenticatedContext = Record<string, un
|
|
|
188
193
|
isAndroid: boolean;
|
|
189
194
|
};
|
|
190
195
|
}, OpenApiMeta, {
|
|
196
|
+
method: string;
|
|
197
|
+
url: string;
|
|
191
198
|
origin: string;
|
|
192
199
|
ip: string;
|
|
193
200
|
user: {
|
|
@@ -209,8 +216,6 @@ export declare function getTrpc<ExtendedAuthenticatedContext = Record<string, un
|
|
|
209
216
|
email: string;
|
|
210
217
|
userId: string;
|
|
211
218
|
};
|
|
212
|
-
method: string;
|
|
213
|
-
url: string;
|
|
214
219
|
xTenantId: string;
|
|
215
220
|
getLocation: () => Promise<import("..").LocationOutput>;
|
|
216
221
|
endpoint: string;
|
|
@@ -262,7 +267,7 @@ export declare function getTrpc<ExtendedAuthenticatedContext = Record<string, un
|
|
|
262
267
|
};
|
|
263
268
|
};
|
|
264
269
|
meta: OpenApiMeta;
|
|
265
|
-
errorShape:
|
|
270
|
+
errorShape: DefaultErrorShape;
|
|
266
271
|
transformer: false;
|
|
267
272
|
}>;
|
|
268
273
|
t: import("@trpc/server").TRPCRootObject<{
|
|
@@ -301,6 +306,42 @@ export declare function getTrpc<ExtendedAuthenticatedContext = Record<string, un
|
|
|
301
306
|
isAndroid: boolean;
|
|
302
307
|
};
|
|
303
308
|
}, OpenApiMeta, {
|
|
309
|
+
errorFormatter: ErrorFormatter<{
|
|
310
|
+
user: {
|
|
311
|
+
decodedToken: {
|
|
312
|
+
iss: string;
|
|
313
|
+
aud: string;
|
|
314
|
+
auth_time: number;
|
|
315
|
+
sub: string;
|
|
316
|
+
iat: number;
|
|
317
|
+
exp: number;
|
|
318
|
+
email: string;
|
|
319
|
+
email_verified: boolean;
|
|
320
|
+
uid: string;
|
|
321
|
+
displayName?: string;
|
|
322
|
+
name?: string;
|
|
323
|
+
ownerId?: string;
|
|
324
|
+
user_id?: string;
|
|
325
|
+
};
|
|
326
|
+
email: string;
|
|
327
|
+
userId: string;
|
|
328
|
+
};
|
|
329
|
+
url: string;
|
|
330
|
+
method: string;
|
|
331
|
+
xTenantId: string;
|
|
332
|
+
origin: string;
|
|
333
|
+
ip: string;
|
|
334
|
+
getLocation(): Promise<import("..").LocationOutput>;
|
|
335
|
+
endpoint: string;
|
|
336
|
+
device: {
|
|
337
|
+
isMobile: boolean;
|
|
338
|
+
isWebApp: boolean;
|
|
339
|
+
isMacPC: boolean;
|
|
340
|
+
os: any;
|
|
341
|
+
isIOS: boolean;
|
|
342
|
+
isAndroid: boolean;
|
|
343
|
+
};
|
|
344
|
+
}, DefaultErrorShape>;
|
|
304
345
|
sse: {
|
|
305
346
|
maxDurationMs: number;
|
|
306
347
|
ping: {
|
|
@@ -349,7 +390,7 @@ export declare function getTrpc<ExtendedAuthenticatedContext = Record<string, un
|
|
|
349
390
|
};
|
|
350
391
|
};
|
|
351
392
|
meta: OpenApiMeta;
|
|
352
|
-
errorShape:
|
|
393
|
+
errorShape: DefaultErrorShape;
|
|
353
394
|
transformer: false;
|
|
354
395
|
}>;
|
|
355
396
|
};
|
package/dist/server/trpc.js
CHANGED
package/dist/server/trpc.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"trpc.js","sourceRoot":"","sources":["../../src/server/trpc.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"trpc.js","sourceRoot":"","sources":["../../src/server/trpc.ts"],"names":[],"mappings":";;AASA,0BA0HC;AAnID,yCAAkD;AASlD,SAAgB,OAAO,CAGrB,MASD;IACC,MAAM,CAAC,GAAG,iBAAQ;SACf,OAAO,EAAe;SACtB,IAAI,EAAe;SACnB,MAAM,CAAC;QACN,cAAc,EAAE,MAAM,EAAE,cAAc;QACtC,GAAG,EAAE;YACH,aAAa,EAAE,CAAC,GAAG,EAAE,GAAG,IAAI;YAC5B,IAAI,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE;YACzC,MAAM,EAAE,EAAE,0BAA0B,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