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 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 { default as LixnetRequest } from "./lib/util/request";
7
- export type { ReadonlyHeaders, ReadonlyRequestCookies, RequestCookie, } from "./lib/util/request";
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
@@ -3,4 +3,3 @@ 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 { default as LixnetRequest } from "./lib/util/request";
@@ -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 LixnetRequest from "./util/request";
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 = LixnetRequest(requestClone);
67
+ const newRequest = wrapLixnetRequest(requestClone);
68
68
  const data = await event.handler({
69
69
  ...validatedInput,
70
70
  request: newRequest,
@@ -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 LixnetServer_HandlerInjections = {
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
- export default function (request: Request): LixnetRequest;
38
+ /** Used by the server only; not part of the public package API. */
39
+ export declare function wrapLixnetRequest(request: Request): LixnetRequest;
@@ -111,7 +111,8 @@ export class ReadonlyHeaders {
111
111
  return this.h[Symbol.iterator]();
112
112
  }
113
113
  }
114
- function wrapLixnetRequest(request) {
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
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lixnet",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "author": "nitlix",
5
5
  "license": "MIT",
6
6
  "repository": {