lixnet 1.3.0 → 1.3.1
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/exports.d.ts +2 -3
- package/dist/exports.js +0 -1
- package/dist/lib/server.js +2 -2
- package/dist/lib/types.d.ts +1 -1
- package/dist/lib/util/request.d.ts +2 -1
- package/dist/lib/util/request.js +2 -4
- package/package.json +1 -1
package/dist/exports.d.ts
CHANGED
|
@@ -3,6 +3,5 @@ import LixnetClient from "./lib/client";
|
|
|
3
3
|
import LixnetPeer from "./lib/peer";
|
|
4
4
|
import { LixnetResponse } from "./lib/util/response";
|
|
5
5
|
export { LixnetServer, LixnetClient, LixnetPeer, LixnetResponse };
|
|
6
|
-
export {
|
|
7
|
-
export type {
|
|
8
|
-
export type { LXN_ServerClient_EventType, LXNServerHandler, FunctionInput, LXN_ServerClient_Request, } from "./lib/types";
|
|
6
|
+
export type { LixnetRequest, ReadonlyHeaders, ReadonlyRequestCookies, RequestCookie, } from "./lib/util/request";
|
|
7
|
+
export type { LXN_ServerClient_EventType, LXNServerHandler, FunctionInput, LXN_ServerClient_Request, LixnetServerInjections, } from "./lib/types";
|
package/dist/exports.js
CHANGED
package/dist/lib/server.js
CHANGED
|
@@ -2,7 +2,7 @@ import { z } from "zod";
|
|
|
2
2
|
import LixnetLog from "./util/log";
|
|
3
3
|
import { LixnetResponse } from "./util/response";
|
|
4
4
|
import defaultFormatter from "./util/formatter";
|
|
5
|
-
import
|
|
5
|
+
import { wrapLixnetRequest } from "./util/request";
|
|
6
6
|
export default class LixnetServer {
|
|
7
7
|
events = {};
|
|
8
8
|
logger = LixnetLog;
|
|
@@ -64,7 +64,7 @@ export default class LixnetServer {
|
|
|
64
64
|
? event.schema.parse(jsonData.input)
|
|
65
65
|
: jsonData.input;
|
|
66
66
|
try {
|
|
67
|
-
const newRequest =
|
|
67
|
+
const newRequest = wrapLixnetRequest(requestClone);
|
|
68
68
|
const data = await event.handler({
|
|
69
69
|
...validatedInput,
|
|
70
70
|
request: newRequest,
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -14,7 +14,7 @@ export type LXNServerHandler<Input, Output> = (input: Input) => Promise<Output>
|
|
|
14
14
|
export type LXN_ServerClient_EventType = object;
|
|
15
15
|
/** The inbound request passed to handlers (Next.js–style `cookies()` / `headers()`). */
|
|
16
16
|
export type { LixnetRequest as LXN_ServerClient_Request } from "./util/request";
|
|
17
|
-
export type
|
|
17
|
+
export type LixnetServerInjections = {
|
|
18
18
|
request: LixnetRequest;
|
|
19
19
|
response: LixnetResponse;
|
|
20
20
|
};
|
|
@@ -35,4 +35,5 @@ export type LixnetRequest = Omit<Request, "headers"> & {
|
|
|
35
35
|
cookies(): ReadonlyRequestCookies;
|
|
36
36
|
headers(): ReadonlyHeaders;
|
|
37
37
|
};
|
|
38
|
-
|
|
38
|
+
/** Used by the server only; not part of the public package API. */
|
|
39
|
+
export declare function wrapLixnetRequest(request: Request): LixnetRequest;
|
package/dist/lib/util/request.js
CHANGED
|
@@ -111,7 +111,8 @@ export class ReadonlyHeaders {
|
|
|
111
111
|
return this.h[Symbol.iterator]();
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
|
|
114
|
+
/** Used by the server only; not part of the public package API. */
|
|
115
|
+
export function wrapLixnetRequest(request) {
|
|
115
116
|
const snapshot = new Headers(request.headers);
|
|
116
117
|
return new Proxy(request, {
|
|
117
118
|
get(target, prop, receiver) {
|
|
@@ -129,6 +130,3 @@ function wrapLixnetRequest(request) {
|
|
|
129
130
|
},
|
|
130
131
|
});
|
|
131
132
|
}
|
|
132
|
-
export default function (request) {
|
|
133
|
-
return wrapLixnetRequest(request);
|
|
134
|
-
}
|