@kuckit/api 2.0.2 → 2.0.5
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/error-handler.d.ts +6 -2
- package/dist/error-handler.d.ts.map +1 -1
- package/dist/error-handler.js +5 -3
- package/dist/error-handler.js.map +1 -1
- package/dist/routers/index.d.ts +1 -10
- package/dist/routers/index.d.ts.map +1 -1
- package/dist/routers/profile.d.ts +1 -10
- package/dist/routers/profile.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/error-handler.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { ORPCError } from "@orpc/server";
|
|
2
|
+
import { ORPCErrorCode } from "@orpc/client";
|
|
2
3
|
|
|
3
4
|
//#region src/error-handler.d.ts
|
|
4
|
-
|
|
5
|
+
interface ErrorData {
|
|
6
|
+
code: string;
|
|
7
|
+
meta?: Record<string, unknown>;
|
|
8
|
+
}
|
|
5
9
|
/**
|
|
6
10
|
* Map AppError to oRPC errors
|
|
7
11
|
* Preserves error details for logging while providing proper HTTP status codes
|
|
8
12
|
*/
|
|
9
|
-
declare const mapAppErrorToORPC: (error: unknown) => ORPCError
|
|
13
|
+
declare const mapAppErrorToORPC: (error: unknown) => ORPCError<ORPCErrorCode, ErrorData | undefined>;
|
|
10
14
|
//#endregion
|
|
11
15
|
export { mapAppErrorToORPC };
|
|
12
16
|
//# sourceMappingURL=error-handler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-handler.d.ts","names":[],"sources":["../src/error-handler.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"error-handler.d.ts","names":[],"sources":["../src/error-handler.ts"],"sourcesContent":[],"mappings":";;;;UAIU,SAAA;;EAAA,IAAA,CAAA,EAEF,MAFW,CAAA,MAAA,EAAA,OAEX,CAAM;AAOd;;;;;cAAa,uCAEV,UAAU,eAAe"}
|
package/dist/error-handler.js
CHANGED
|
@@ -9,7 +9,7 @@ const mapAppErrorToORPC = (error) => {
|
|
|
9
9
|
const appError = error;
|
|
10
10
|
if (!appError?.code) return new ORPCError("INTERNAL_SERVER_ERROR", {
|
|
11
11
|
message: error instanceof Error ? error.message : "Unknown error",
|
|
12
|
-
code: "INTERNAL_SERVER_ERROR"
|
|
12
|
+
data: { code: "INTERNAL_SERVER_ERROR" }
|
|
13
13
|
});
|
|
14
14
|
return new ORPCError({
|
|
15
15
|
400: "BAD_REQUEST",
|
|
@@ -20,8 +20,10 @@ const mapAppErrorToORPC = (error) => {
|
|
|
20
20
|
500: "INTERNAL_SERVER_ERROR"
|
|
21
21
|
}[appError.statusCode] || "INTERNAL_SERVER_ERROR", {
|
|
22
22
|
message: appError.message,
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
data: {
|
|
24
|
+
code: appError.code,
|
|
25
|
+
meta: appError.meta
|
|
26
|
+
}
|
|
25
27
|
});
|
|
26
28
|
};
|
|
27
29
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error-handler.js","names":[],"sources":["../src/error-handler.ts"],"sourcesContent":["import { ORPCError } from '@orpc/server'\nimport type { AppError } from '@kuckit/domain'\n\n/**\n * Map AppError to oRPC errors\n * Preserves error details for logging while providing proper HTTP status codes\n */\nexport const mapAppErrorToORPC = (
|
|
1
|
+
{"version":3,"file":"error-handler.js","names":[],"sources":["../src/error-handler.ts"],"sourcesContent":["import { ORPCError } from '@orpc/server'\nimport type { ORPCErrorCode } from '@orpc/client'\nimport type { AppError } from '@kuckit/domain'\n\ninterface ErrorData {\n\tcode: string\n\tmeta?: Record<string, unknown>\n}\n\n/**\n * Map AppError to oRPC errors\n * Preserves error details for logging while providing proper HTTP status codes\n */\nexport const mapAppErrorToORPC = (\n\terror: unknown\n): ORPCError<ORPCErrorCode, ErrorData | undefined> => {\n\tconst appError = error as AppError\n\n\tif (!appError?.code) {\n\t\t// Not an AppError, wrap as internal server error\n\t\treturn new ORPCError('INTERNAL_SERVER_ERROR', {\n\t\t\tmessage: error instanceof Error ? error.message : 'Unknown error',\n\t\t\tdata: { code: 'INTERNAL_SERVER_ERROR' },\n\t\t})\n\t}\n\n\t// Map status codes to oRPC error codes\n\tconst statusCodeMap: Record<number, ORPCErrorCode> = {\n\t\t400: 'BAD_REQUEST',\n\t\t401: 'UNAUTHORIZED',\n\t\t403: 'FORBIDDEN',\n\t\t404: 'NOT_FOUND',\n\t\t409: 'CONFLICT',\n\t\t500: 'INTERNAL_SERVER_ERROR',\n\t}\n\n\tconst orpcCode = statusCodeMap[appError.statusCode] || 'INTERNAL_SERVER_ERROR'\n\n\treturn new ORPCError(orpcCode, {\n\t\tmessage: appError.message,\n\t\tdata: { code: appError.code, meta: appError.meta },\n\t})\n}\n"],"mappings":";;;;;;;AAaA,MAAa,qBACZ,UACqD;CACrD,MAAM,WAAW;AAEjB,KAAI,CAAC,UAAU,KAEd,QAAO,IAAI,UAAU,yBAAyB;EAC7C,SAAS,iBAAiB,QAAQ,MAAM,UAAU;EAClD,MAAM,EAAE,MAAM,yBAAyB;EACvC,CAAC;AAeH,QAAO,IAAI,UAX0C;EACpD,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,KAAK;EACL,CAE8B,SAAS,eAAe,yBAExB;EAC9B,SAAS,SAAS;EAClB,MAAM;GAAE,MAAM,SAAS;GAAM,MAAM,SAAS;GAAM;EAClD,CAAC"}
|
package/dist/routers/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import * as awilix7 from "awilix";
|
|
2
2
|
import * as _orpc_server10 from "@orpc/server";
|
|
3
3
|
import { RouterClient } from "@orpc/server";
|
|
4
|
-
import * as zod0 from "zod";
|
|
5
|
-
import * as zod_v4_core0 from "zod/v4/core";
|
|
6
4
|
|
|
7
5
|
//#region src/routers/index.d.ts
|
|
8
6
|
declare const appRouter: {
|
|
@@ -49,14 +47,7 @@ declare const appRouter: {
|
|
|
49
47
|
di: awilix7.AwilixContainer<any>;
|
|
50
48
|
}, {
|
|
51
49
|
session: any;
|
|
52
|
-
}>, _orpc_server10.Schema<unknown, unknown>,
|
|
53
|
-
id: zod0.ZodString;
|
|
54
|
-
name: zod0.ZodString;
|
|
55
|
-
email: zod0.ZodString;
|
|
56
|
-
emailVerified: zod0.ZodBoolean;
|
|
57
|
-
createdAt: zod0.ZodString;
|
|
58
|
-
updatedAt: zod0.ZodString;
|
|
59
|
-
}, zod_v4_core0.$strip>, Record<never, never>, Record<never, never>>;
|
|
50
|
+
}>, _orpc_server10.Schema<unknown, unknown>, any, Record<never, never>, Record<never, never>>;
|
|
60
51
|
};
|
|
61
52
|
};
|
|
62
53
|
type AppRouter = typeof appRouter;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/routers/index.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../src/routers/index.ts"],"sourcesContent":[],"mappings":";;;;;cAIa;;;QAWZ,OAAA,CAAA;EAXY,CAAA,SAAA,CAAA,KAWZ,EAAA,KAAA,CAAA,EAAA;IAAA,OAAA,EAAA,GAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IACW,CAAA,CAAA,qCAA4B,CAAA;MAC5B,OAAA,EAAA,GAAe;;;;;;;KADf,SAAA,UAAmB;KACnB,eAAA,GAAkB,oBAAoB"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import * as awilix17 from "awilix";
|
|
2
2
|
import * as _orpc_server22 from "@orpc/server";
|
|
3
|
-
import * as zod6 from "zod";
|
|
4
|
-
import * as zod_v4_core0 from "zod/v4/core";
|
|
5
3
|
|
|
6
4
|
//#region src/routers/profile.d.ts
|
|
7
5
|
declare const profileRouter: {
|
|
@@ -22,14 +20,7 @@ declare const profileRouter: {
|
|
|
22
20
|
di: awilix17.AwilixContainer<any>;
|
|
23
21
|
}, {
|
|
24
22
|
session: any;
|
|
25
|
-
}>, _orpc_server22.Schema<unknown, unknown>,
|
|
26
|
-
id: zod6.ZodString;
|
|
27
|
-
name: zod6.ZodString;
|
|
28
|
-
email: zod6.ZodString;
|
|
29
|
-
emailVerified: zod6.ZodBoolean;
|
|
30
|
-
createdAt: zod6.ZodString;
|
|
31
|
-
updatedAt: zod6.ZodString;
|
|
32
|
-
}, zod_v4_core0.$strip>, Record<never, never>, Record<never, never>>;
|
|
23
|
+
}>, _orpc_server22.Schema<unknown, unknown>, any, Record<never, never>, Record<never, never>>;
|
|
33
24
|
};
|
|
34
25
|
//#endregion
|
|
35
26
|
export { profileRouter };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.d.ts","names":[],"sources":["../../src/routers/profile.ts"],"sourcesContent":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"profile.d.ts","names":[],"sources":["../../src/routers/profile.ts"],"sourcesContent":[],"mappings":";;;;cAGa;;;;EAAA,EAAA,mCAaZ,oCAAA,CAAA;IAAA,OAAA,EAAA,GAAA;QAAA,QAAA,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kuckit/api",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"dotenv": "^17.2.2",
|
|
41
41
|
"zod": "^4.1.11",
|
|
42
42
|
"awilix": "^12.0.5",
|
|
43
|
-
"@kuckit/auth": "^2.0.
|
|
44
|
-
"@kuckit/db": "^2.0.
|
|
45
|
-
"@kuckit/contracts": "^2.0.
|
|
43
|
+
"@kuckit/auth": "^2.0.5",
|
|
44
|
+
"@kuckit/db": "^2.0.5",
|
|
45
|
+
"@kuckit/contracts": "^2.0.5"
|
|
46
46
|
}
|
|
47
47
|
}
|