@sx3/ultra 0.0.1 → 0.0.3
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/LICENSE +20 -20
- package/README.md +512 -512
- package/dist/auth.d.mts +16 -16
- package/dist/auth.mjs +1 -84
- package/dist/client.d.mts +9 -9
- package/dist/client.mjs +1 -131
- package/dist/context-BAOh_2qI.mjs +1 -0
- package/dist/context.d.mts +1 -1
- package/dist/context.mjs +1 -10
- package/dist/cors.d.mts +3 -3
- package/dist/cors.mjs +1 -58
- package/dist/crypto-DrpstqPB.mjs +1 -0
- package/dist/crypto.mjs +1 -44
- package/dist/error-CvEWFOYT.mjs +1 -0
- package/dist/error.mjs +1 -3
- package/dist/{http-BqWCMASL.d.mts → http-CD8MvQOV.d.mts} +2 -2
- package/dist/http.d.mts +2 -2
- package/dist/http.mjs +1 -1
- package/dist/{middleware-COKreBGP.d.mts → middleware-DVREjjkO.d.mts} +4 -4
- package/dist/middleware.d.mts +3 -3
- package/dist/middleware.mjs +1 -1
- package/dist/procedure-BekIoOQX.mjs +1 -0
- package/dist/procedure.d.mts +3 -3
- package/dist/procedure.mjs +1 -3
- package/dist/response-D9PTLpdq.mjs +1 -0
- package/dist/response.mjs +1 -3
- package/dist/rpc-D9H6IkRD.mjs +1 -0
- package/dist/{rpc-Ch2UXReT.d.mts → rpc-DADpT17P.d.mts} +1 -1
- package/dist/rpc.d.mts +1 -1
- package/dist/rpc.mjs +1 -3
- package/dist/session.d.mts +4 -4
- package/dist/session.mjs +1 -181
- package/dist/test.d.mts +1 -0
- package/dist/test.mjs +1 -0
- package/dist/types.d.mts +1 -1
- package/dist/types.mjs +1 -1
- package/dist/ultra.d.mts +7 -7
- package/dist/ultra.mjs +1 -273
- package/dist/validation-s1s8P8HO.mjs +1 -0
- package/dist/validation.d.mts +1 -1
- package/dist/validation.mjs +1 -3
- package/package.json +10 -3
- package/dist/error-CII1zMOR.mjs +0 -45
- package/dist/procedure-BN1rLLRX.mjs +0 -86
- package/dist/response-CNhIkAYG.mjs +0 -59
- package/dist/rpc-_rBI0z-9.mjs +0 -7
- package/dist/validation-Cop5Wvlr.mjs +0 -12
- /package/dist/{context-ChCsZh7S.d.mts → context-DNamt_XE.d.mts} +0 -0
- /package/dist/{types-Cn69QrjS.d.mts → types-CzIiTHWF.d.mts} +0 -0
- /package/dist/{validation-CkRfxQJ_.d.mts → validation-Dfgqsq2f.d.mts} +0 -0
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { n as UltraError } from "./error-CII1zMOR.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/response.ts
|
|
4
|
-
function toHTTPResponse(data) {
|
|
5
|
-
switch (true) {
|
|
6
|
-
case data instanceof Response: return data;
|
|
7
|
-
case data instanceof UltraError: return data.toResponse();
|
|
8
|
-
case data instanceof Error: return new Response("Internal Server Error", { status: 500 });
|
|
9
|
-
case typeof data === "object": return Response.json(data);
|
|
10
|
-
case !data: return new Response(null, { status: 204 });
|
|
11
|
-
default: return new Response(String(data));
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
function toRPCResponse(id, data) {
|
|
15
|
-
let result;
|
|
16
|
-
switch (true) {
|
|
17
|
-
case data instanceof UltraError:
|
|
18
|
-
result = {
|
|
19
|
-
id,
|
|
20
|
-
error: {
|
|
21
|
-
code: data.status,
|
|
22
|
-
message: data.message
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
break;
|
|
26
|
-
case data instanceof Error:
|
|
27
|
-
result = {
|
|
28
|
-
id,
|
|
29
|
-
error: {
|
|
30
|
-
code: 500,
|
|
31
|
-
message: data.message
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
break;
|
|
35
|
-
case data instanceof Response:
|
|
36
|
-
result = {
|
|
37
|
-
id,
|
|
38
|
-
error: {
|
|
39
|
-
code: data.status,
|
|
40
|
-
message: data.statusText
|
|
41
|
-
}
|
|
42
|
-
};
|
|
43
|
-
break;
|
|
44
|
-
case typeof data === "object" || typeof data === "number" || typeof data === "boolean":
|
|
45
|
-
result = {
|
|
46
|
-
id,
|
|
47
|
-
result: data
|
|
48
|
-
};
|
|
49
|
-
break;
|
|
50
|
-
default: result = {
|
|
51
|
-
id,
|
|
52
|
-
result: String(data)
|
|
53
|
-
};
|
|
54
|
-
}
|
|
55
|
-
return JSON.stringify(result);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
//#endregion
|
|
59
|
-
export { toRPCResponse as n, toHTTPResponse as t };
|
package/dist/rpc-_rBI0z-9.mjs
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { a as ValidationError } from "./error-CII1zMOR.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/validation.ts
|
|
4
|
-
async function validate(schema, input) {
|
|
5
|
-
let result = schema["~standard"].validate(input);
|
|
6
|
-
if (result instanceof Promise) result = await result;
|
|
7
|
-
if (result.issues) throw new ValidationError(JSON.stringify(result.issues, null, 2));
|
|
8
|
-
return result.value;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
//#endregion
|
|
12
|
-
export { validate as t };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|