@rpcbase/client 0.414.0 → 0.416.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.
@@ -0,0 +1,18 @@
1
+ let reporter;
2
+ const setClientExceptionReporter = (next) => {
3
+ reporter = next;
4
+ };
5
+ const reportClientException = (error, context = {}) => {
6
+ if (!error) return;
7
+ const err = error instanceof Error ? error : new Error(String(error));
8
+ try {
9
+ reporter?.(err, context);
10
+ } catch (reportError) {
11
+ console.error("[rb/client] exception reporter failed", reportError);
12
+ }
13
+ };
14
+ export {
15
+ reportClientException as r,
16
+ setClientExceptionReporter as s
17
+ };
18
+ //# sourceMappingURL=errorReporting-CVoUUKxW.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errorReporting-CVoUUKxW.js","sources":["../src/errorReporting.ts"],"sourcesContent":["export type ClientExceptionContext = {\n reactContext?: \"uncaught\" | \"caught\" | \"recoverable\"\n componentStack?: string\n}\n\nexport type ClientExceptionReporter = (error: Error, context: ClientExceptionContext) => void\n\nlet reporter: ClientExceptionReporter | undefined\n\nexport const setClientExceptionReporter = (next: ClientExceptionReporter | undefined) => {\n reporter = next\n}\n\nexport const reportClientException = (error: unknown, context: ClientExceptionContext = {}) => {\n if (!error) return\n\n const err = error instanceof Error ? error : new Error(String(error))\n\n try {\n reporter?.(err, context)\n } catch (reportError) {\n console.error(\"[rb/client] exception reporter failed\", reportError)\n }\n}\n\n"],"names":["reporter","setClientExceptionReporter","next","reportClientException","error","context","err","Error","String","reportError","console"],"mappings":"AAOA,IAAIA;AAEG,MAAMC,6BAA6BA,CAACC,SAA8C;AACvFF,aAAWE;AACb;AAEO,MAAMC,wBAAwBA,CAACC,OAAgBC,UAAkC,OAAO;AAC7F,MAAI,CAACD,MAAO;AAEZ,QAAME,MAAMF,iBAAiBG,QAAQH,QAAQ,IAAIG,MAAMC,OAAOJ,KAAK,CAAC;AAEpE,MAAI;AACFJ,eAAWM,KAAKD,OAAO;AAAA,EACzB,SAASI,aAAa;AACpBC,YAAQN,MAAM,yCAAyCK,WAAW;AAAA,EACpE;AACF;"}
@@ -0,0 +1,178 @@
1
+ const getServerApiClient = async (app) => {
2
+ const callRoute = async (app2, method, matchPath, requestUrl, req, res) => {
3
+ return new Promise((resolve, reject) => {
4
+ let isEnded = false;
5
+ let timeoutId = null;
6
+ const resolveRequest = (data) => {
7
+ if (isEnded) return;
8
+ isEnded = true;
9
+ if (timeoutId) clearTimeout(timeoutId);
10
+ resolve(data);
11
+ };
12
+ const rejectRequest = (error) => {
13
+ if (isEnded) return;
14
+ isEnded = true;
15
+ if (timeoutId) clearTimeout(timeoutId);
16
+ reject(error);
17
+ };
18
+ const mockReq = {
19
+ ...req,
20
+ method: method.toUpperCase(),
21
+ url: requestUrl
22
+ };
23
+ const mockRes = {
24
+ ...res,
25
+ json: (data) => {
26
+ resolveRequest(data);
27
+ },
28
+ status: (statusCode) => {
29
+ console.log("Status:", statusCode, mockReq.method, mockReq.url);
30
+ return mockRes;
31
+ }
32
+ };
33
+ const routerStack = app2.router.stack;
34
+ const firstApiMiddlewareIndex = routerStack.findIndex((layer) => layer.name === "__FIRST_API_MIDDLEWARE__");
35
+ if (!(firstApiMiddlewareIndex > -1)) {
36
+ throw new Error("middleware: __FIRST_API_MIDDLEWARE__ was not found in stack");
37
+ }
38
+ const apiStack = routerStack.slice(firstApiMiddlewareIndex + 1);
39
+ const processLayer = async (index) => {
40
+ if (index >= apiStack.length || isEnded) return;
41
+ const layer = apiStack[index];
42
+ const isNonMatchingLayer = !layer.match(matchPath);
43
+ if (isNonMatchingLayer) {
44
+ await processLayer(index + 1);
45
+ return;
46
+ }
47
+ const runHandler = async (handler) => new Promise((resolveMiddleware, rejectMiddleware) => {
48
+ handler(mockReq, mockRes, (err) => {
49
+ if (err) {
50
+ console.error("Middleware error:", err);
51
+ rejectMiddleware(err);
52
+ return;
53
+ }
54
+ resolveMiddleware();
55
+ });
56
+ });
57
+ if (layer.route) {
58
+ if (!layer.route.methods[method.toLowerCase()]) {
59
+ await processLayer(index + 1);
60
+ return;
61
+ }
62
+ if (layer.route.stack.length !== 1) {
63
+ throw new Error(`expected only one handler per route for route: ${layer.route.path}`);
64
+ }
65
+ await runHandler(layer.route.stack[0].handle);
66
+ } else {
67
+ await runHandler(layer.handle);
68
+ }
69
+ if (!isEnded) {
70
+ await processLayer(index + 1);
71
+ }
72
+ };
73
+ void processLayer(0).catch((err) => {
74
+ rejectRequest(err);
75
+ });
76
+ timeoutId = setTimeout(() => {
77
+ rejectRequest(new Error("Route handler timed out"));
78
+ }, 3e4);
79
+ });
80
+ };
81
+ const mergeQueryValues = (target, key, value) => {
82
+ const existing = target[key];
83
+ if (Array.isArray(existing)) {
84
+ existing.push(value);
85
+ return;
86
+ }
87
+ if (typeof existing === "string") {
88
+ target[key] = [existing, value];
89
+ return;
90
+ }
91
+ target[key] = value;
92
+ };
93
+ const toQueryValue = (value) => {
94
+ if (typeof value === "string") return value;
95
+ if (typeof value === "number") return Number.isFinite(value) ? String(value) : null;
96
+ if (typeof value === "boolean") return value ? "true" : "false";
97
+ if (typeof value === "bigint") return String(value);
98
+ if (value instanceof Date) return value.toISOString();
99
+ return null;
100
+ };
101
+ const buildQuery = (path, payload) => {
102
+ const url = new URL(path, "http://localhost");
103
+ const query = {};
104
+ for (const [key, value] of url.searchParams) {
105
+ mergeQueryValues(query, key, value);
106
+ }
107
+ for (const [key, rawValue] of Object.entries(payload)) {
108
+ if (!key) continue;
109
+ if (Array.isArray(rawValue)) {
110
+ for (const item of rawValue) {
111
+ const converted2 = toQueryValue(item);
112
+ if (converted2 !== null) mergeQueryValues(query, key, converted2);
113
+ }
114
+ continue;
115
+ }
116
+ const converted = toQueryValue(rawValue);
117
+ if (converted !== null) mergeQueryValues(query, key, converted);
118
+ }
119
+ const searchParams = new URLSearchParams();
120
+ for (const [key, rawValue] of Object.entries(query)) {
121
+ if (Array.isArray(rawValue)) {
122
+ for (const value of rawValue) {
123
+ searchParams.append(key, value);
124
+ }
125
+ continue;
126
+ }
127
+ searchParams.append(key, rawValue);
128
+ }
129
+ const matchPath = url.pathname;
130
+ const requestUrl = `${matchPath}${searchParams.toString() ? `?${searchParams.toString()}` : ""}`;
131
+ return {
132
+ matchPath,
133
+ requestUrl,
134
+ query
135
+ };
136
+ };
137
+ const createMethod = (method) => {
138
+ return async (path, payload, ctx) => {
139
+ if (!ctx) {
140
+ throw new Error("Context must be provided in SSR mode");
141
+ }
142
+ const normalizedMethod = method.toLowerCase();
143
+ if (normalizedMethod === "get") {
144
+ const {
145
+ matchPath: matchPath2,
146
+ requestUrl: requestUrl2,
147
+ query: query2
148
+ } = buildQuery(path, payload);
149
+ return callRoute(app, method, matchPath2, requestUrl2, {
150
+ ...ctx.req,
151
+ body: {},
152
+ query: query2
153
+ }, ctx.res);
154
+ }
155
+ const {
156
+ matchPath,
157
+ requestUrl,
158
+ query
159
+ } = buildQuery(path, {});
160
+ return callRoute(app, method, matchPath, requestUrl, {
161
+ ...ctx.req,
162
+ body: payload,
163
+ query
164
+ }, ctx.res);
165
+ };
166
+ };
167
+ const apiClient = {
168
+ get: createMethod("get"),
169
+ post: createMethod("post"),
170
+ put: createMethod("put"),
171
+ delete: createMethod("delete")
172
+ };
173
+ return apiClient;
174
+ };
175
+ export {
176
+ getServerApiClient
177
+ };
178
+ //# sourceMappingURL=getServerApiClient-BzqOKL0g.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getServerApiClient-BzqOKL0g.js","sources":["../src/apiClient/getServerApiClient.ts"],"sourcesContent":["import { Application, IRouter, Request, Response } from \"express\"\nimport type { Ctx } from \"@rpcbase/api\"\n\n\ntype NextMiddleware = (err?: unknown) => void\ntype LayerHandler = (req: Request, res: Response, next: NextMiddleware) => void\n\ntype RouterLayer = {\n name: string\n match: (path: string) => boolean\n handle: LayerHandler\n route?: {\n methods: Record<string, boolean | undefined>\n path: string\n stack: Array<{ handle: LayerHandler }>\n }\n}\n\n\nexport const getServerApiClient = async(app: Application) => {\n const callRoute = async <TResponse = Record<string, unknown>>(\n app: Application,\n method: string,\n matchPath: string,\n requestUrl: string,\n req: Partial<Request>,\n res: Partial<Response>\n ): Promise<TResponse> => {\n return new Promise((resolve, reject) => {\n let isEnded = false\n let timeoutId: ReturnType<typeof setTimeout> | null = null\n\n const resolveRequest = (data: TResponse) => {\n if (isEnded) return\n isEnded = true\n if (timeoutId) clearTimeout(timeoutId)\n resolve(data)\n }\n\n const rejectRequest = (error: unknown) => {\n if (isEnded) return\n isEnded = true\n if (timeoutId) clearTimeout(timeoutId)\n reject(error)\n }\n\n const mockReq = {\n ...req,\n method: method.toUpperCase(),\n url: requestUrl\n } as Request\n\n const mockRes = {\n ...res,\n json: (data: unknown) => {\n resolveRequest(data as TResponse)\n },\n status: (statusCode: number) => {\n console.log(\"Status:\", statusCode, mockReq.method, mockReq.url)\n return mockRes\n },\n } as Response\n\n const routerStack = (app.router as unknown as IRouter).stack as unknown as RouterLayer[]\n\n const firstApiMiddlewareIndex = routerStack.findIndex((layer) => layer.name === \"__FIRST_API_MIDDLEWARE__\")\n if (!(firstApiMiddlewareIndex > -1)) {\n throw new Error(\"middleware: __FIRST_API_MIDDLEWARE__ was not found in stack\")\n }\n\n const apiStack = routerStack.slice(firstApiMiddlewareIndex + 1)\n\n const processLayer = async (index: number) => {\n if (index >= apiStack.length || isEnded) return\n\n const layer = apiStack[index]\n\n const isNonMatchingLayer = !layer.match(matchPath)\n if (isNonMatchingLayer) {\n // console.log(\"not machthing route:\", matchPath, \"to layer:\", index, layer.name, layer, \"reason: \", {isNonMatchingLayer})\n await processLayer(index + 1)\n return\n }\n\n const runHandler = async(handler: LayerHandler) => new Promise<void>((resolveMiddleware, rejectMiddleware) => {\n handler(mockReq, mockRes, (err?: unknown) => {\n if (err) {\n console.error(\"Middleware error:\", err)\n rejectMiddleware(err)\n return\n }\n resolveMiddleware()\n })\n })\n\n if (layer.route) {\n if (!layer.route.methods[method.toLowerCase()]) {\n // console.log(\"not machthing route:\", matchPath, \"to route layer:\", index, layer.name, layer, \"reason: method not matching\")\n await processLayer(index + 1)\n return\n }\n\n if (layer.route.stack.length !== 1) {\n throw new Error(`expected only one handler per route for route: ${layer.route.path}`)\n }\n\n await runHandler(layer.route.stack[0].handle)\n\n } else {\n await runHandler(layer.handle)\n }\n\n if (!isEnded) {\n await processLayer(index + 1)\n }\n }\n\n void processLayer(0).catch((err) => {\n rejectRequest(err)\n })\n\n // Set a timeout to prevent hanging\n timeoutId = setTimeout(() => {\n rejectRequest(new Error(\"Route handler timed out\"))\n }, 30000)\n })\n }\n\n const mergeQueryValues = (target: Record<string, string | string[]>, key: string, value: string) => {\n const existing = target[key]\n if (Array.isArray(existing)) {\n existing.push(value)\n return\n }\n\n if (typeof existing === \"string\") {\n target[key] = [existing, value]\n return\n }\n\n target[key] = value\n }\n\n const toQueryValue = (value: unknown): string | null => {\n if (typeof value === \"string\") return value\n if (typeof value === \"number\") return Number.isFinite(value) ? String(value) : null\n if (typeof value === \"boolean\") return value ? \"true\" : \"false\"\n if (typeof value === \"bigint\") return String(value)\n if (value instanceof Date) return value.toISOString()\n return null\n }\n\n const buildQuery = (path: string, payload: Record<string, unknown>) => {\n const url = new URL(path, \"http://localhost\")\n\n const query: Record<string, string | string[]> = {}\n for (const [key, value] of url.searchParams) {\n mergeQueryValues(query, key, value)\n }\n\n for (const [key, rawValue] of Object.entries(payload)) {\n if (!key) continue\n\n if (Array.isArray(rawValue)) {\n for (const item of rawValue) {\n const converted = toQueryValue(item)\n if (converted !== null) mergeQueryValues(query, key, converted)\n }\n continue\n }\n\n const converted = toQueryValue(rawValue)\n if (converted !== null) mergeQueryValues(query, key, converted)\n }\n\n const searchParams = new URLSearchParams()\n for (const [key, rawValue] of Object.entries(query)) {\n if (Array.isArray(rawValue)) {\n for (const value of rawValue) {\n searchParams.append(key, value)\n }\n continue\n }\n\n searchParams.append(key, rawValue)\n }\n\n const matchPath = url.pathname\n const requestUrl = `${matchPath}${searchParams.toString() ? `?${searchParams.toString()}` : \"\"}`\n\n return { matchPath, requestUrl, query }\n }\n\n const createMethod = (method: string) => {\n return async <TResponse = Record<string, unknown>>(\n path: string,\n payload: Record<string, unknown>,\n ctx?: Ctx,\n ): Promise<TResponse> => {\n if (!ctx) {\n throw new Error(\"Context must be provided in SSR mode\")\n }\n\n const normalizedMethod = method.toLowerCase()\n\n if (normalizedMethod === \"get\") {\n const { matchPath, requestUrl, query } = buildQuery(path, payload)\n return callRoute<TResponse>(app, method, matchPath, requestUrl, { ...ctx.req, body: {}, query }, ctx.res)\n }\n\n const { matchPath, requestUrl, query } = buildQuery(path, {})\n return callRoute<TResponse>(app, method, matchPath, requestUrl, { ...ctx.req, body: payload, query }, ctx.res)\n }\n }\n\n const apiClient = {\n get: createMethod(\"get\"),\n post: createMethod(\"post\"),\n put: createMethod(\"put\"),\n delete: createMethod(\"delete\")\n }\n\n return apiClient\n}\n\nexport default getServerApiClient\n"],"names":["getServerApiClient","app","callRoute","method","matchPath","requestUrl","req","res","Promise","resolve","reject","isEnded","timeoutId","resolveRequest","data","rejectRequest","error","mockReq","toUpperCase","url","mockRes","json","status","statusCode","console","log","routerStack","router","stack","firstApiMiddlewareIndex","findIndex","layer","name","Error","apiStack","slice","processLayer","index","length","isNonMatchingLayer","match","runHandler","handler","resolveMiddleware","rejectMiddleware","err","route","methods","toLowerCase","path","handle","catch","setTimeout","mergeQueryValues","target","key","value","existing","Array","isArray","push","toQueryValue","Number","isFinite","String","Date","toISOString","buildQuery","payload","URL","query","searchParams","rawValue","Object","entries","item","converted","URLSearchParams","append","pathname","toString","createMethod","ctx","normalizedMethod","body","apiClient","get","post","put","delete"],"mappings":"AAmBO,MAAMA,qBAAqB,OAAMC,QAAqB;AAC3D,QAAMC,YAAY,OAChBD,MACAE,QACAC,WACAC,YACAC,KACAC,QACuB;AACvB,WAAO,IAAIC,QAAQ,CAACC,SAASC,WAAW;AACtC,UAAIC,UAAU;AACd,UAAIC,YAAkD;AAEtD,YAAMC,iBAAiBA,CAACC,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