@lyxa.ai/core 1.0.170-test1 → 1.0.171
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/libraries/dispatcher/index.d.ts +1 -2
- package/dist/libraries/dispatcher/index.js +1 -2
- package/dist/libraries/dispatcher/index.js.map +1 -1
- package/dist/libraries/trpc/context.d.ts +12 -13
- package/dist/libraries/trpc/context.js +2 -4
- package/dist/libraries/trpc/context.js.map +1 -1
- package/dist/libraries/trpc/index.d.ts +153 -46
- package/dist/libraries/trpc/index.js.map +1 -1
- package/dist/libraries/trpc/middlewares/auth.d.ts +32 -9
- package/dist/libraries/trpc/middlewares/phone-verified.d.ts +32 -9
- package/dist/libraries/trpc/middlewares/publicUserDecoder.d.ts +32 -9
- package/dist/types/README.md +1 -1
- package/dist/types/package.json +1 -1
- package/dist/utilities/common/logs-common-methods.d.ts +1 -1
- package/dist/utilities/common/logs-common-methods.js +2 -2
- package/dist/utilities/common/logs-common-methods.js.map +1 -1
- package/package.json +3 -7
|
@@ -5,6 +5,5 @@ export declare class MicroServiceDispatcher {
|
|
|
5
5
|
constructor(secretService: SecretManagerService);
|
|
6
6
|
getMicroService<T extends AnyRouter>(serviceName: string, customURL?: string, options?: {
|
|
7
7
|
headers?: Record<string, string>;
|
|
8
|
-
|
|
9
|
-
}): Promise<import("@trpc/client").TRPCClient<T>>;
|
|
8
|
+
}): Promise<import("@trpc/client").CreateTRPCProxyClient<T>>;
|
|
10
9
|
}
|
|
@@ -25,12 +25,11 @@ let MicroServiceDispatcher = class MicroServiceDispatcher {
|
|
|
25
25
|
if (!deploymentURL) {
|
|
26
26
|
throw new Error('The requested service does not have a configured secret URL');
|
|
27
27
|
}
|
|
28
|
-
return (0, client_1.
|
|
28
|
+
return (0, client_1.createTRPCProxyClient)({
|
|
29
29
|
links: [
|
|
30
30
|
(0, client_1.httpBatchLink)({
|
|
31
31
|
url: deploymentURL,
|
|
32
32
|
headers: async () => options?.headers ?? {},
|
|
33
|
-
transformer: options?.transformer,
|
|
34
33
|
}),
|
|
35
34
|
],
|
|
36
35
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/dispatcher/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAAiC;AACjC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/dispatcher/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAAiC;AACjC,yCAAoE;AAEpE,wCAAkD;AAG3C,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAC1B,cAAc,CAAuB;IAE7C,YAAY,aAAmC;QAC9C,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;IACrC,CAAC;IAEM,KAAK,CAAC,eAAe,CAC3B,WAAmB,EACnB,SAAkB,EAClB,OAEC;QAED,MAAM,aAAa,GAClB,SAAS;YACT,CAAC,MAAM,IAAI,CAAC,cAAc,CAAC,MAAM,CAChC,2BAA2B,GAAG,WAAW,CAAC,WAAW,EAAE,GAAG,WAAW,CACrE,CAAC,CAAC;QAEJ,OAAO,CAAC,GAAG,CAAC,aAAa,EAAE,iBAAiB,CAAC,CAAC;QAE9C,IAAI,CAAC,aAAa,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,6DAA6D,CAAC,CAAC;QAChF,CAAC;QAGD,OAAO,IAAA,8BAAqB,EAAI;YAC/B,KAAK,EAAE;gBACN,IAAA,sBAAa,EAAC;oBACb,GAAG,EAAE,aAAa;oBAClB,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,IAAI,EAAE;iBAC3C,CAAC;aACF;SAED,CAAC,CAAC;IACJ,CAAC;CACD,CAAA;AArCY,wDAAsB;iCAAtB,sBAAsB;IADlC,IAAA,gBAAO,GAAE;qCAIkB,8BAAoB;GAHnC,sBAAsB,CAqClC","sourcesContent":["import { Service } from 'typedi';\nimport { createTRPCProxyClient, httpBatchLink } from '@trpc/client';\nimport { AnyRouter } from '@trpc/server';\nimport { SecretManagerService } from '../secrets';\n\n@Service()\nexport class MicroServiceDispatcher {\n\tprivate _secretService: SecretManagerService;\n\n\tconstructor(secretService: SecretManagerService) {\n\t\tthis._secretService = secretService;\n\t}\n\n\tpublic async getMicroService<T extends AnyRouter>(\n\t\tserviceName: string,\n\t\tcustomURL?: string,\n\t\toptions?: {\n\t\t\theaders?: Record<string, string>;\n\t\t}\n\t) {\n\t\tconst deploymentURL =\n\t\t\tcustomURL ??\n\t\t\t(await this._secretService.getKey(\n\t\t\t\t'DEPLOYMENTS_MICROSERVICE_' + serviceName.toUpperCase() + '_ENDPOINT'\n\t\t\t));\n\n\t\tconsole.log(deploymentURL, 'deploymentURL--');\n\n\t\tif (!deploymentURL) {\n\t\t\tthrow new Error('The requested service does not have a configured secret URL');\n\t\t}\n\n\t\t// @ts-ignore\n\t\treturn createTRPCProxyClient<T>({\n\t\t\tlinks: [\n\t\t\t\thttpBatchLink({\n\t\t\t\t\turl: deploymentURL,\n\t\t\t\t\theaders: async () => options?.headers ?? {},\n\t\t\t\t}),\n\t\t\t],\n\t\t\t//special http request header that has a token\n\t\t});\n\t}\n}\n"]}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { CreateHTTPContextOptions } from '@trpc/server/adapters/standalone';
|
|
2
|
-
import type { NodeHTTPCreateContextFnOptions } from '@trpc/server/adapters/node-http';
|
|
1
|
+
import { CreateHTTPContextOptions } from '@trpc/server/dist/adapters/standalone';
|
|
3
2
|
import type { CreateWSSContextFnOptions } from '@trpc/server/adapters/ws';
|
|
4
3
|
import { AuthEntityType } from '../auth';
|
|
5
4
|
import jwt from 'jsonwebtoken';
|
|
6
5
|
import { TokenType } from '../auth';
|
|
7
|
-
import type { IncomingMessage, ServerResponse } from 'http';
|
|
8
6
|
export interface EntityContext extends jwt.JwtPayload {
|
|
9
7
|
id: string;
|
|
10
8
|
type: AuthEntityType;
|
|
@@ -17,14 +15,15 @@ export interface LyxaContextParams {
|
|
|
17
15
|
usedRefreshToken?: boolean;
|
|
18
16
|
tokenRenewed?: boolean;
|
|
19
17
|
}
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
18
|
+
export declare const createLyxaContext: (opts: CreateHTTPContextOptions) => Promise<CreateHTTPContextOptions & LyxaContextParams>;
|
|
19
|
+
export declare const createLyxaWsContext: (opts: CreateWSSContextFnOptions) => Promise<{
|
|
20
|
+
entity: undefined;
|
|
21
|
+
requestId: undefined;
|
|
22
|
+
tokenType: undefined;
|
|
23
|
+
usedRefreshToken: boolean;
|
|
24
|
+
tokenRenewed: boolean;
|
|
25
|
+
req: import("http").IncomingMessage;
|
|
26
|
+
res: import("ws").WebSocket;
|
|
27
|
+
}>;
|
|
30
28
|
export type LyxaContext = Awaited<ReturnType<typeof createLyxaContext>>;
|
|
29
|
+
export type LyxaWSContext = Awaited<ReturnType<typeof createLyxaWsContext>>;
|
|
@@ -3,25 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createLyxaWsContext = exports.createLyxaContext = void 0;
|
|
4
4
|
const createLyxaContext = async (opts) => {
|
|
5
5
|
return {
|
|
6
|
+
...opts,
|
|
6
7
|
entity: undefined,
|
|
7
8
|
requestId: undefined,
|
|
8
9
|
tokenType: undefined,
|
|
9
10
|
usedRefreshToken: false,
|
|
10
11
|
tokenRenewed: false,
|
|
11
|
-
req: opts.req,
|
|
12
|
-
res: opts.res,
|
|
13
12
|
};
|
|
14
13
|
};
|
|
15
14
|
exports.createLyxaContext = createLyxaContext;
|
|
16
15
|
const createLyxaWsContext = async (opts) => {
|
|
17
16
|
return {
|
|
17
|
+
...opts,
|
|
18
18
|
entity: undefined,
|
|
19
19
|
requestId: undefined,
|
|
20
20
|
tokenType: undefined,
|
|
21
21
|
usedRefreshToken: false,
|
|
22
22
|
tokenRenewed: false,
|
|
23
|
-
req: opts.req,
|
|
24
|
-
res: opts.res,
|
|
25
23
|
};
|
|
26
24
|
};
|
|
27
25
|
exports.createLyxaWsContext = createLyxaWsContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"/","sources":["libraries/trpc/context.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"/","sources":["libraries/trpc/context.ts"],"names":[],"mappings":";;;AAqBO,MAAM,iBAAiB,GAAG,KAAK,EACrC,IAA8B,EAC0B,EAAE;IAC1D,OAAO;QACN,GAAG,IAAI;QACP,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,SAAS;QACpB,SAAS,EAAE,SAAS;QACpB,gBAAgB,EAAE,KAAK;QACvB,YAAY,EAAE,KAAK;KACnB,CAAC;AACH,CAAC,CAAC;AAXW,QAAA,iBAAiB,qBAW5B;AAEK,MAAM,mBAAmB,GAAG,KAAK,EAAE,IAA+B,EAAE,EAAE;IAC5E,OAAO;QACN,GAAG,IAAI;QACP,MAAM,EAAE,SAAS;QACjB,SAAS,EAAE,SAAS;QACpB,SAAS,EAAE,SAAS;QACpB,gBAAgB,EAAE,KAAK;QACvB,YAAY,EAAE,KAAK;KACnB,CAAC;AACH,CAAC,CAAC;AATW,QAAA,mBAAmB,uBAS9B","sourcesContent":["import { CreateHTTPContextOptions } from '@trpc/server/dist/adapters/standalone';\nimport type { CreateWSSContextFnOptions } from '@trpc/server/adapters/ws';\nimport { AuthEntityType } from '../auth';\nimport jwt from 'jsonwebtoken';\nimport { TokenType } from '../auth';\nimport { request } from 'http';\n\nexport interface EntityContext extends jwt.JwtPayload {\n\tid: string;\n\ttype: AuthEntityType;\n\tparameters: Record<string, unknown>;\n}\n\nexport interface LyxaContextParams {\n\tentity?: EntityContext;\n\trequestId?: string;\n\ttokenType?: TokenType;\n\tusedRefreshToken?: boolean;\n\ttokenRenewed?: boolean;\n}\n\nexport const createLyxaContext = async (\n\topts: CreateHTTPContextOptions\n): Promise<CreateHTTPContextOptions & LyxaContextParams> => {\n\treturn {\n\t\t...opts,\n\t\tentity: undefined,\n\t\trequestId: undefined,\n\t\ttokenType: undefined,\n\t\tusedRefreshToken: false,\n\t\ttokenRenewed: false,\n\t};\n};\n\nexport const createLyxaWsContext = async (opts: CreateWSSContextFnOptions) => {\n\treturn {\n\t\t...opts,\n\t\tentity: undefined,\n\t\trequestId: undefined,\n\t\ttokenType: undefined,\n\t\tusedRefreshToken: false,\n\t\ttokenRenewed: false,\n\t};\n};\n\nexport type LyxaContext = Awaited<ReturnType<typeof createLyxaContext>>;\nexport type LyxaWSContext = Awaited<ReturnType<typeof createLyxaWsContext>>;\n"]}
|
|
@@ -1,71 +1,178 @@
|
|
|
1
|
-
export declare const t:
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
export declare const t: {
|
|
2
|
+
_config: import("@trpc/server").RootConfig<{
|
|
3
|
+
ctx: import("@trpc/server/dist/adapters/standalone").CreateHTTPContextOptions & import("./context").LyxaContextParams;
|
|
4
|
+
meta: object;
|
|
5
|
+
errorShape: {
|
|
6
|
+
message: string;
|
|
7
|
+
data: {
|
|
8
|
+
stack: undefined;
|
|
9
|
+
path: undefined;
|
|
10
|
+
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_KEY;
|
|
11
|
+
httpStatus: number;
|
|
12
|
+
};
|
|
12
13
|
stack: undefined;
|
|
13
|
-
|
|
14
|
-
code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
|
|
15
|
-
httpStatus: number;
|
|
14
|
+
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
|
|
16
15
|
};
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
17
|
+
}>;
|
|
18
|
+
procedure: import("@trpc/server").ProcedureBuilder<{
|
|
19
|
+
_config: import("@trpc/server").RootConfig<{
|
|
20
|
+
ctx: import("@trpc/server/dist/adapters/standalone").CreateHTTPContextOptions & import("./context").LyxaContextParams;
|
|
21
|
+
meta: object;
|
|
22
|
+
errorShape: {
|
|
23
|
+
message: string;
|
|
24
|
+
data: {
|
|
25
|
+
stack: undefined;
|
|
26
|
+
path: undefined;
|
|
27
|
+
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_KEY;
|
|
28
|
+
httpStatus: number;
|
|
29
|
+
};
|
|
30
|
+
stack: undefined;
|
|
31
|
+
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
|
|
32
|
+
};
|
|
33
|
+
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
34
|
+
}>;
|
|
35
|
+
_ctx_out: import("@trpc/server/dist/adapters/standalone").CreateHTTPContextOptions & import("./context").LyxaContextParams;
|
|
36
|
+
_input_in: typeof import("@trpc/server").unsetMarker;
|
|
37
|
+
_input_out: typeof import("@trpc/server").unsetMarker;
|
|
38
|
+
_output_in: typeof import("@trpc/server").unsetMarker;
|
|
39
|
+
_output_out: typeof import("@trpc/server").unsetMarker;
|
|
40
|
+
_meta: object;
|
|
41
|
+
}>;
|
|
42
|
+
middleware: <TNewParams extends import("@trpc/server").ProcedureParams<import("@trpc/server").AnyRootConfig, unknown, unknown, unknown, unknown, unknown, unknown>>(fn: import("@trpc/server").MiddlewareFunction<{
|
|
43
|
+
_config: import("@trpc/server").RootConfig<{
|
|
44
|
+
ctx: import("@trpc/server/dist/adapters/standalone").CreateHTTPContextOptions & import("./context").LyxaContextParams;
|
|
45
|
+
meta: object;
|
|
46
|
+
errorShape: {
|
|
47
|
+
message: string;
|
|
48
|
+
data: {
|
|
49
|
+
stack: undefined;
|
|
50
|
+
path: undefined;
|
|
51
|
+
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_KEY;
|
|
52
|
+
httpStatus: number;
|
|
53
|
+
};
|
|
54
|
+
stack: undefined;
|
|
55
|
+
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
|
|
56
|
+
};
|
|
57
|
+
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
58
|
+
}>;
|
|
59
|
+
_ctx_out: {};
|
|
60
|
+
_input_out: typeof import("@trpc/server").unsetMarker;
|
|
61
|
+
_input_in: unknown;
|
|
62
|
+
_output_in: unknown;
|
|
63
|
+
_output_out: unknown;
|
|
64
|
+
_meta: object;
|
|
65
|
+
}, TNewParams>) => import("@trpc/server").MiddlewareBuilder<{
|
|
66
|
+
_config: import("@trpc/server").RootConfig<{
|
|
67
|
+
ctx: import("@trpc/server/dist/adapters/standalone").CreateHTTPContextOptions & import("./context").LyxaContextParams;
|
|
68
|
+
meta: object;
|
|
69
|
+
errorShape: {
|
|
70
|
+
message: string;
|
|
71
|
+
data: {
|
|
72
|
+
stack: undefined;
|
|
73
|
+
path: undefined;
|
|
74
|
+
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_KEY;
|
|
75
|
+
httpStatus: number;
|
|
76
|
+
};
|
|
77
|
+
stack: undefined;
|
|
78
|
+
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
|
|
79
|
+
};
|
|
80
|
+
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
81
|
+
}>;
|
|
82
|
+
_ctx_out: {};
|
|
83
|
+
_input_out: typeof import("@trpc/server").unsetMarker;
|
|
84
|
+
_input_in: unknown;
|
|
85
|
+
_output_in: unknown;
|
|
86
|
+
_output_out: unknown;
|
|
87
|
+
_meta: object;
|
|
88
|
+
}, TNewParams>;
|
|
89
|
+
router: <TProcRouterRecord extends import("@trpc/server").ProcedureRouterRecord>(procedures: TProcRouterRecord) => import("@trpc/server").CreateRouterInner<import("@trpc/server").RootConfig<{
|
|
90
|
+
ctx: import("@trpc/server/dist/adapters/standalone").CreateHTTPContextOptions & import("./context").LyxaContextParams;
|
|
91
|
+
meta: object;
|
|
92
|
+
errorShape: {
|
|
93
|
+
message: string;
|
|
94
|
+
data: {
|
|
95
|
+
stack: undefined;
|
|
96
|
+
path: undefined;
|
|
97
|
+
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_KEY;
|
|
98
|
+
httpStatus: number;
|
|
99
|
+
};
|
|
26
100
|
stack: undefined;
|
|
27
|
-
|
|
28
|
-
code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
|
|
29
|
-
httpStatus: number;
|
|
101
|
+
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
|
|
30
102
|
};
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
103
|
+
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
104
|
+
}>, TProcRouterRecord>;
|
|
105
|
+
mergeRouters: typeof import("@trpc/server").mergeRouters;
|
|
106
|
+
createCallerFactory: <TRouter extends import("@trpc/server").Router<import("@trpc/server").AnyRouterDef<import("@trpc/server").RootConfig<{
|
|
107
|
+
ctx: import("@trpc/server/dist/adapters/standalone").CreateHTTPContextOptions & import("./context").LyxaContextParams;
|
|
108
|
+
meta: object;
|
|
109
|
+
errorShape: {
|
|
110
|
+
message: string;
|
|
111
|
+
data: {
|
|
112
|
+
stack: undefined;
|
|
113
|
+
path: undefined;
|
|
114
|
+
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_KEY;
|
|
115
|
+
httpStatus: number;
|
|
116
|
+
};
|
|
117
|
+
stack: undefined;
|
|
118
|
+
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
|
|
119
|
+
};
|
|
120
|
+
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
121
|
+
}>, any>>>(router: TRouter) => import("@trpc/server").RouterCaller<TRouter["_def"]>;
|
|
122
|
+
};
|
|
123
|
+
export declare const publicProcedure: import("@trpc/server").ProcedureBuilder<{
|
|
124
|
+
_config: import("@trpc/server").RootConfig<{
|
|
125
|
+
ctx: import("@trpc/server/dist/adapters/standalone").CreateHTTPContextOptions & import("./context").LyxaContextParams;
|
|
126
|
+
meta: object;
|
|
127
|
+
errorShape: {
|
|
128
|
+
message: string;
|
|
129
|
+
data: {
|
|
130
|
+
stack: undefined;
|
|
131
|
+
path: undefined;
|
|
132
|
+
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_KEY;
|
|
133
|
+
httpStatus: number;
|
|
134
|
+
};
|
|
135
|
+
stack: undefined;
|
|
136
|
+
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
|
|
137
|
+
};
|
|
138
|
+
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
139
|
+
}>;
|
|
140
|
+
_ctx_out: import("@trpc/server/dist/adapters/standalone").CreateHTTPContextOptions & import("./context").LyxaContextParams;
|
|
141
|
+
_input_in: typeof import("@trpc/server").unsetMarker;
|
|
142
|
+
_input_out: typeof import("@trpc/server").unsetMarker;
|
|
143
|
+
_output_in: typeof import("@trpc/server").unsetMarker;
|
|
144
|
+
_output_out: typeof import("@trpc/server").unsetMarker;
|
|
145
|
+
_meta: object;
|
|
35
146
|
}>;
|
|
36
|
-
export declare const
|
|
37
|
-
|
|
38
|
-
ctx: import("./context").LyxaHTTPContext;
|
|
147
|
+
export declare const createTRPCRouter: <TProcRouterRecord extends import("@trpc/server").ProcedureRouterRecord>(procedures: TProcRouterRecord) => import("@trpc/server").CreateRouterInner<import("@trpc/server").RootConfig<{
|
|
148
|
+
ctx: import("@trpc/server/dist/adapters/standalone").CreateHTTPContextOptions & import("./context").LyxaContextParams;
|
|
39
149
|
meta: object;
|
|
40
150
|
errorShape: {
|
|
41
151
|
message: string;
|
|
42
152
|
data: {
|
|
43
153
|
stack: undefined;
|
|
44
154
|
path: undefined;
|
|
45
|
-
code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
|
|
155
|
+
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_KEY;
|
|
46
156
|
httpStatus: number;
|
|
47
157
|
};
|
|
48
158
|
stack: undefined;
|
|
49
|
-
code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
|
|
159
|
+
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
|
|
50
160
|
};
|
|
51
|
-
transformer:
|
|
52
|
-
}>;
|
|
53
|
-
export declare const createCallerFactory: import("@trpc/server").
|
|
54
|
-
ctx: import("./context").
|
|
161
|
+
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
162
|
+
}>, TProcRouterRecord>;
|
|
163
|
+
export declare const createCallerFactory: <TRouter extends import("@trpc/server").Router<import("@trpc/server").AnyRouterDef<import("@trpc/server").RootConfig<{
|
|
164
|
+
ctx: import("@trpc/server/dist/adapters/standalone").CreateHTTPContextOptions & import("./context").LyxaContextParams;
|
|
55
165
|
meta: object;
|
|
56
166
|
errorShape: {
|
|
57
167
|
message: string;
|
|
58
168
|
data: {
|
|
59
169
|
stack: undefined;
|
|
60
170
|
path: undefined;
|
|
61
|
-
code: import("@trpc/server").TRPC_ERROR_CODE_KEY;
|
|
171
|
+
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_KEY;
|
|
62
172
|
httpStatus: number;
|
|
63
173
|
};
|
|
64
174
|
stack: undefined;
|
|
65
|
-
code: import("@trpc/server").TRPC_ERROR_CODE_NUMBER;
|
|
175
|
+
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
|
|
66
176
|
};
|
|
67
|
-
transformer:
|
|
68
|
-
}>;
|
|
69
|
-
export type { inferRouterInputs, inferRouterOutputs } from '@trpc/server';
|
|
70
|
-
export type { AnyTRPCRouter } from '@trpc/server';
|
|
71
|
-
export type LyxaRouter = ReturnType<typeof createTRPCRouter>;
|
|
177
|
+
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
178
|
+
}>, any>>>(router: TRouter) => import("@trpc/server").RouterCaller<TRouter["_def"]>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/trpc/index.ts"],"names":[],"mappings":";;;AAAA,yCAAwC;AACxC,6BAA+B;AAGlB,QAAA,CAAC,GAAG,iBAAQ,CAAC,OAAO,EAAe,CAAC,MAAM,CAAC;IACvD,cAAc,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE;QAC9B,IAAI,SAAS,GAAG,IAAI,CAAC;QAErB,IAAI,KAAK,CAAC,IAAI,KAAK,aAAa,IAAI,KAAK,CAAC,KAAK,YAAY,cAAQ,EAAE,CAAC;YACrE,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACxC,SAAS,GAAG,SAAS,CAAC,WAAW,CAAC;QACnC,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;QAE5D,OAAO;YACN,GAAG,KAAK;YACR,OAAO,EACN,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ;gBACzC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO;gBACnD,CAAC,CAAC,KAAK,CAAC,OAAO;YACjB,IAAI,EAAE;gBACL,GAAG,KAAK,CAAC,IAAI;gBAEb,KAAK,EAAE,SAAS;gBAChB,IAAI,EAAE,SAAS;aACf;YAED,KAAK,EAAE,SAAS;SAChB,CAAC;IACH,CAAC;CACD,CAAC,CAAC;AAEU,QAAA,eAAe,GAAG,SAAC,CAAC,SAAS,CAAC;AAC9B,QAAA,gBAAgB,GAAG,SAAC,CAAC,MAAM,CAAC;AAC5B,QAAA,mBAAmB,GAAG,SAAC,CAAC,mBAAmB,CAAC","sourcesContent":["import { initTRPC } from '@trpc/server';\nimport { ZodError } from 'zod';\nimport { LyxaContext } from './context';\n\nexport const t = initTRPC.context<LyxaContext>().create({\n\terrorFormatter({ shape, error }) {\n\t\tlet zodErrors = null;\n\n\t\tif (error.code === 'BAD_REQUEST' && error.cause instanceof ZodError) {\n\t\t\tconst flattened = error.cause.flatten();\n\t\t\tzodErrors = flattened.fieldErrors;\n\t\t}\n\n\t\tconsole.log('Error:', error, shape, 'error log', zodErrors);\n\n\t\treturn {\n\t\t\t...shape,\n\t\t\tmessage:\n\t\t\t\tzodErrors && typeof zodErrors === 'object'\n\t\t\t\t\t? Object.values(zodErrors)[0]?.[0] || shape.message\n\t\t\t\t\t: shape.message,\n\t\t\tdata: {\n\t\t\t\t...shape.data,\n\n\t\t\t\tstack: undefined,\n\t\t\t\tpath: undefined,\n\t\t\t},\n\t\t\t// Prevent stack trace from being returned in the response\n\t\t\tstack: undefined,\n\t\t};\n\t},\n});\n\nexport const publicProcedure = t.procedure;\nexport const createTRPCRouter = t.router;\nexport const createCallerFactory = t.createCallerFactory;\n
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"/","sources":["libraries/trpc/index.ts"],"names":[],"mappings":";;;AAAA,yCAAwC;AACxC,6BAA+B;AAGlB,QAAA,CAAC,GAAG,iBAAQ,CAAC,OAAO,EAAe,CAAC,MAAM,CAAC;IACvD,cAAc,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE;QAC9B,IAAI,SAAS,GAAG,IAAI,CAAC;QAErB,IAAI,KAAK,CAAC,IAAI,KAAK,aAAa,IAAI,KAAK,CAAC,KAAK,YAAY,cAAQ,EAAE,CAAC;YACrE,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;YACxC,SAAS,GAAG,SAAS,CAAC,WAAW,CAAC;QACnC,CAAC;QAED,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;QAE5D,OAAO;YACN,GAAG,KAAK;YACR,OAAO,EACN,SAAS,IAAI,OAAO,SAAS,KAAK,QAAQ;gBACzC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,OAAO;gBACnD,CAAC,CAAC,KAAK,CAAC,OAAO;YACjB,IAAI,EAAE;gBACL,GAAG,KAAK,CAAC,IAAI;gBAEb,KAAK,EAAE,SAAS;gBAChB,IAAI,EAAE,SAAS;aACf;YAED,KAAK,EAAE,SAAS;SAChB,CAAC;IACH,CAAC;CACD,CAAC,CAAC;AAEU,QAAA,eAAe,GAAG,SAAC,CAAC,SAAS,CAAC;AAC9B,QAAA,gBAAgB,GAAG,SAAC,CAAC,MAAM,CAAC;AAC5B,QAAA,mBAAmB,GAAG,SAAC,CAAC,mBAAmB,CAAC","sourcesContent":["import { initTRPC } from '@trpc/server';\nimport { ZodError } from 'zod';\nimport { LyxaContext } from './context';\n\nexport const t = initTRPC.context<LyxaContext>().create({\n\terrorFormatter({ shape, error }) {\n\t\tlet zodErrors = null;\n\n\t\tif (error.code === 'BAD_REQUEST' && error.cause instanceof ZodError) {\n\t\t\tconst flattened = error.cause.flatten();\n\t\t\tzodErrors = flattened.fieldErrors;\n\t\t}\n\n\t\tconsole.log('Error:', error, shape, 'error log', zodErrors);\n\n\t\treturn {\n\t\t\t...shape,\n\t\t\tmessage:\n\t\t\t\tzodErrors && typeof zodErrors === 'object'\n\t\t\t\t\t? Object.values(zodErrors)[0]?.[0] || shape.message\n\t\t\t\t\t: shape.message,\n\t\t\tdata: {\n\t\t\t\t...shape.data,\n\n\t\t\t\tstack: undefined,\n\t\t\t\tpath: undefined,\n\t\t\t},\n\t\t\t// Prevent stack trace from being returned in the response\n\t\t\tstack: undefined,\n\t\t};\n\t},\n});\n\nexport const publicProcedure = t.procedure;\nexport const createTRPCRouter = t.router;\nexport const createCallerFactory = t.createCallerFactory;\n"]}
|
|
@@ -4,13 +4,36 @@ interface AuthOptions {
|
|
|
4
4
|
allowRefreshToken?: boolean;
|
|
5
5
|
autoRefresh?: boolean;
|
|
6
6
|
}
|
|
7
|
-
export declare function createAuthenticatedProcedure(options: AuthOptions): import("@trpc/server").
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
export declare function createAuthenticatedProcedure(options: AuthOptions): import("@trpc/server").ProcedureBuilder<{
|
|
8
|
+
_config: import("@trpc/server").RootConfig<{
|
|
9
|
+
ctx: import("@trpc/server/dist/adapters/standalone").CreateHTTPContextOptions & import("../context").LyxaContextParams;
|
|
10
|
+
meta: object;
|
|
11
|
+
errorShape: {
|
|
12
|
+
message: string;
|
|
13
|
+
data: {
|
|
14
|
+
stack: undefined;
|
|
15
|
+
path: undefined;
|
|
16
|
+
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_KEY;
|
|
17
|
+
httpStatus: number;
|
|
18
|
+
};
|
|
19
|
+
stack: undefined;
|
|
20
|
+
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
|
|
21
|
+
};
|
|
22
|
+
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
23
|
+
}>;
|
|
24
|
+
_meta: object;
|
|
25
|
+
_ctx_out: {
|
|
26
|
+
requestId: string | undefined;
|
|
27
|
+
res: import("http").ServerResponse<import("http").IncomingMessage>;
|
|
28
|
+
tokenType: TokenType | undefined;
|
|
29
|
+
entity: import("../context").EntityContext | undefined;
|
|
30
|
+
req: import("http").IncomingMessage;
|
|
31
|
+
usedRefreshToken: boolean | undefined;
|
|
32
|
+
tokenRenewed: boolean | undefined;
|
|
33
|
+
};
|
|
34
|
+
_input_in: typeof import("@trpc/server").unsetMarker;
|
|
35
|
+
_input_out: typeof import("@trpc/server").unsetMarker;
|
|
36
|
+
_output_in: typeof import("@trpc/server").unsetMarker;
|
|
37
|
+
_output_out: typeof import("@trpc/server").unsetMarker;
|
|
38
|
+
}>;
|
|
16
39
|
export {};
|
|
@@ -2,13 +2,36 @@ import { AuthEntityType } from '../../auth';
|
|
|
2
2
|
interface PhoneVerifiedOptions {
|
|
3
3
|
entityTypes: AuthEntityType[];
|
|
4
4
|
}
|
|
5
|
-
export declare function createPhoneVerifiedProcedure(options: PhoneVerifiedOptions): import("@trpc/server").
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
export declare function createPhoneVerifiedProcedure(options: PhoneVerifiedOptions): import("@trpc/server").ProcedureBuilder<{
|
|
6
|
+
_config: import("@trpc/server").RootConfig<{
|
|
7
|
+
ctx: import("@trpc/server/dist/adapters/standalone").CreateHTTPContextOptions & import("../context").LyxaContextParams;
|
|
8
|
+
meta: object;
|
|
9
|
+
errorShape: {
|
|
10
|
+
message: string;
|
|
11
|
+
data: {
|
|
12
|
+
stack: undefined;
|
|
13
|
+
path: undefined;
|
|
14
|
+
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_KEY;
|
|
15
|
+
httpStatus: number;
|
|
16
|
+
};
|
|
17
|
+
stack: undefined;
|
|
18
|
+
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
|
|
19
|
+
};
|
|
20
|
+
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
21
|
+
}>;
|
|
22
|
+
_meta: object;
|
|
23
|
+
_ctx_out: {
|
|
24
|
+
requestId: string | undefined;
|
|
25
|
+
res: import("http").ServerResponse<import("http").IncomingMessage>;
|
|
26
|
+
tokenType: import("../../auth").TokenType | undefined;
|
|
27
|
+
entity: import("../context").EntityContext | undefined;
|
|
28
|
+
req: import("http").IncomingMessage;
|
|
29
|
+
usedRefreshToken: boolean | undefined;
|
|
30
|
+
tokenRenewed: boolean | undefined;
|
|
31
|
+
};
|
|
32
|
+
_input_in: typeof import("@trpc/server").unsetMarker;
|
|
33
|
+
_input_out: typeof import("@trpc/server").unsetMarker;
|
|
34
|
+
_output_in: typeof import("@trpc/server").unsetMarker;
|
|
35
|
+
_output_out: typeof import("@trpc/server").unsetMarker;
|
|
36
|
+
}>;
|
|
14
37
|
export {};
|
|
@@ -4,13 +4,36 @@ interface AuthOptions {
|
|
|
4
4
|
allowRefreshToken?: boolean;
|
|
5
5
|
autoRefresh?: boolean;
|
|
6
6
|
}
|
|
7
|
-
export declare function publicUserDecoder(options: AuthOptions): import("@trpc/server").
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
export declare function publicUserDecoder(options: AuthOptions): import("@trpc/server").ProcedureBuilder<{
|
|
8
|
+
_config: import("@trpc/server").RootConfig<{
|
|
9
|
+
ctx: import("@trpc/server/dist/adapters/standalone").CreateHTTPContextOptions & import("../context").LyxaContextParams;
|
|
10
|
+
meta: object;
|
|
11
|
+
errorShape: {
|
|
12
|
+
message: string;
|
|
13
|
+
data: {
|
|
14
|
+
stack: undefined;
|
|
15
|
+
path: undefined;
|
|
16
|
+
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_KEY;
|
|
17
|
+
httpStatus: number;
|
|
18
|
+
};
|
|
19
|
+
stack: undefined;
|
|
20
|
+
code: import("@trpc/server/rpc").TRPC_ERROR_CODE_NUMBER;
|
|
21
|
+
};
|
|
22
|
+
transformer: import("@trpc/server").DefaultDataTransformer;
|
|
23
|
+
}>;
|
|
24
|
+
_meta: object;
|
|
25
|
+
_ctx_out: {
|
|
26
|
+
requestId: string | undefined;
|
|
27
|
+
res: import("http").ServerResponse<import("http").IncomingMessage>;
|
|
28
|
+
tokenType: TokenType | undefined;
|
|
29
|
+
entity: import("../context").EntityContext | undefined;
|
|
30
|
+
req: import("http").IncomingMessage;
|
|
31
|
+
usedRefreshToken: boolean | undefined;
|
|
32
|
+
tokenRenewed: boolean | undefined;
|
|
33
|
+
};
|
|
34
|
+
_input_in: typeof import("@trpc/server").unsetMarker;
|
|
35
|
+
_input_out: typeof import("@trpc/server").unsetMarker;
|
|
36
|
+
_output_in: typeof import("@trpc/server").unsetMarker;
|
|
37
|
+
_output_out: typeof import("@trpc/server").unsetMarker;
|
|
38
|
+
}>;
|
|
16
39
|
export {};
|
package/dist/types/README.md
CHANGED
package/dist/types/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lyxa.ai/types",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.171",
|
|
4
4
|
"description": "Lyxa type definitions and validation schemas for both frontend and backend",
|
|
5
5
|
"author": "elie <42282499+Internalizable@users.noreply.github.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -16,7 +16,7 @@ export declare function extractChangedDocument(changes: Record<string, {
|
|
|
16
16
|
new: any;
|
|
17
17
|
}>, type: 'old' | 'new'): Record<string, any>;
|
|
18
18
|
export declare function publishAdminLogsEvent(payload: {
|
|
19
|
-
|
|
19
|
+
admin: mongoose.Types.ObjectId;
|
|
20
20
|
updatedField: AdminLogsUpdatedFieldsType;
|
|
21
21
|
oldDoc: any;
|
|
22
22
|
newDoc: any;
|
|
@@ -34,9 +34,9 @@ function extractChangedDocument(changes, type) {
|
|
|
34
34
|
return Object.fromEntries(Object.entries(changes).map(([key, value]) => [key, value[type]]));
|
|
35
35
|
}
|
|
36
36
|
async function publishAdminLogsEvent(payload) {
|
|
37
|
-
const {
|
|
37
|
+
const { admin, updatedField, oldDoc, newDoc } = payload;
|
|
38
38
|
const adminActivityLogsEvent = new admin_logs_event_1.AdminActivityLogsEvent({
|
|
39
|
-
admin:
|
|
39
|
+
admin: admin,
|
|
40
40
|
updatedField: updatedField,
|
|
41
41
|
oldDocument: oldDoc,
|
|
42
42
|
newDocument: newDoc,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logs-common-methods.js","sourceRoot":"/","sources":["utilities/common/logs-common-methods.ts"],"names":[],"mappings":";;AASC,4CAwBC;AAMD,sDAUC;AAKD,wDAOC;AAED,sDAcC;AA5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M,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IACxD,MAAM,sBAAsB,GAAuC,IAAI,yCAAsB,CAAC;QAC7F,KAAK,EAAE,KAAK;QACZ,YAAY,EAAE,YAAY;QAC1B,WAAW,EAAE,MAAM;QACnB,WAAW,EAAE,MAAM;KACnB,CAAC,CAAC;IACH,MAAM,IAAA,oBAAY,EAAC,sBAAsB,CAAC,CAAC;AAC5C,CAAC","sourcesContent":["import { mongoose } from \"@typegoose/typegoose\";\nimport { publishEvent } from \"../../libraries/event\";\nimport { BaseEvent } from \"../../libraries/event/BaseEvent\";\nimport { AdminActivityLogsEvent } from \"../../libraries/event/events/admin-logs-event\";\nimport { AdminLogsUpdatedFieldsType } from \"../enum\";\n\n/**\n\t * Returns changed fields between two objects (shallow comparison).\n\t */\n\texport function getChangedFields<T extends Record<string, any>>(\n\t\toldDoc: T,\n\t\tnewDoc: T,\n\t\tpayload?: Partial<T>\n\t): Record<keyof T, { old: any; new: any }> {\n\t\tconst changes = {} as Record<keyof T, { old: any; new: any }>;\n\n\t\tconst oldObj = typeof oldDoc.toObject === 'function' ? oldDoc.toObject() : oldDoc;\n\t\tconst newObj = typeof newDoc.toObject === 'function' ? newDoc.toObject() : newDoc;\n\n\t\tconst keysToCheck = payload\n\t\t\t? Object.keys(payload)\n\t\t\t: Array.from(new Set([...Object.keys(oldObj), ...Object.keys(newObj)]));\n\n\t\tfor (const key of keysToCheck) {\n\t\t\tconst oldValue = oldObj[key];\n\t\t\tconst newValue = newObj[key];\n\n\t\t\tif (payload || JSON.stringify(oldValue) !== JSON.stringify(newValue)) {\n\t\t\t\tchanges[key as keyof T] = { old: oldValue, new: newValue };\n\t\t\t}\n\t\t}\n\n\t\treturn changes;\n\t}\n\n\n\t/**\n\t * Filters changed fields to only those that exist in the payload.\n\t */\n\texport function filterRelevantChanges<T>(\n\t\tallChanges: Record<string, { old: any; new: any }>,\n\t\tpayload: Partial<T>\n\t): Record<string, { old: any; new: any }> {\n\t\treturn Object.keys(payload).reduce((acc, key) => {\n\t\t\tif (allChanges[key]) {\n\t\t\t\tacc[key] = allChanges[key];\n\t\t\t}\n\t\t\treturn acc;\n\t\t}, {} as Record<string, { old: any; new: any }>);\n\t}\n\n\t/**\n\t * Extracts either 'old' or 'new' values from the changes object.\n\t */\n\texport function extractChangedDocument(\n\t\tchanges: Record<string, { old: any; new: any }>,\n\t\ttype: 'old' | 'new'\n\t): Record<string, any> {\n\t\treturn Object.fromEntries(\n\t\t\tObject.entries(changes).map(([key, value]) => [key, value[type]])\n\t\t);\n\t}\n\n\texport async function publishAdminLogsEvent(payload: {\n\t\tadmin: mongoose.Types.ObjectId;\n\t\tupdatedField: AdminLogsUpdatedFieldsType;\n\t\toldDoc: any;\n\t\tnewDoc: any;\n\t}) {\n\t\tconst { admin, updatedField, oldDoc, newDoc } = payload;\n\t\tconst adminActivityLogsEvent: BaseEvent<Record<string, unknown>> = new AdminActivityLogsEvent({\n\t\t\tadmin: admin,\n\t\t\tupdatedField: updatedField,\n\t\t\toldDocument: oldDoc,\n\t\t\tnewDocument: newDoc,\n\t\t});\n\t\tawait publishEvent(adminActivityLogsEvent);\n\t}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lyxa.ai/core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.171",
|
|
4
4
|
"description": "The Core system of the Lyxa services.",
|
|
5
5
|
"author": "elie <42282499+Internalizable@users.noreply.github.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,13 +17,11 @@
|
|
|
17
17
|
"publish:core": "npm publish --ignore-scripts",
|
|
18
18
|
"release": "npm run build && npm run publish:types && npm run publish:core"
|
|
19
19
|
},
|
|
20
|
-
"peerDependencies": {
|
|
21
|
-
"@trpc/server": "^11.4.3",
|
|
22
|
-
"@trpc/client": "^11.4.3"
|
|
23
|
-
},
|
|
24
20
|
"dependencies": {
|
|
25
21
|
"@google-cloud/secret-manager": "^5.6.0",
|
|
26
22
|
"@mapbox/polyline": "^1.2.1",
|
|
23
|
+
"@trpc/client": "^10.45.2",
|
|
24
|
+
"@trpc/server": "^10.45.2",
|
|
27
25
|
"@typegoose/typegoose": "^12.10.1",
|
|
28
26
|
"@types/amqplib": "^0.10.7",
|
|
29
27
|
"@types/node": "^22.10.2",
|
|
@@ -53,8 +51,6 @@
|
|
|
53
51
|
"zod": "^3.24.1"
|
|
54
52
|
},
|
|
55
53
|
"devDependencies": {
|
|
56
|
-
"@trpc/client": "^11.4.3",
|
|
57
|
-
"@trpc/server": "^11.4.3",
|
|
58
54
|
"@types/mapbox__polyline": "^1.0.5",
|
|
59
55
|
"@types/mime-types": "^2.1.4",
|
|
60
56
|
"@types/ws": "^8.18.1",
|