@alwatr/nanotron-api-server 4.2.2 → 4.4.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.
- package/CHANGELOG.md +28 -0
- package/README.md +1 -1
- package/dist/api-client-request.d.ts +2 -3
- package/dist/api-client-request.d.ts.map +1 -1
- package/dist/api-server-response.d.ts +0 -1
- package/dist/api-server-response.d.ts.map +1 -1
- package/dist/api-server.d.ts +3 -3
- package/dist/api-server.d.ts.map +1 -1
- package/dist/main.cjs +801 -4
- package/dist/main.cjs.map +4 -4
- package/dist/main.d.ts +2 -2
- package/dist/main.d.ts.map +1 -1
- package/dist/main.mjs +772 -4
- package/dist/main.mjs.map +4 -4
- package/dist/type.d.ts +2 -3
- package/dist/type.d.ts.map +1 -1
- package/package.json +9 -10
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,34 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [4.4.0](https://github.com/Alwatr/nanotron/compare/v4.3.0...v4.4.0) (2024-10-14)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* **api-server:** add health route to NanotronApiServer ([4f8ede5](https://github.com/Alwatr/nanotron/commit/4f8ede5085cd2fcbd0cd621a09346d4816219e08)) by @
|
|
11
|
+
|
|
12
|
+
## [4.3.0](https://github.com/Alwatr/nanotron/compare/v4.2.2...v4.3.0) (2024-10-11)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
* update `import`s & packages based on the latest changes of `nanolib` & prevent `sideeffects` from `build` result ([1d234b8](https://github.com/Alwatr/nanotron/commit/1d234b83152fb246b793476898e9cf026aa52874)) by @mohammadhonarvar
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **api-server:** update types & `logger` & use `packageTracer` based on last changes of `nanolib` ([7ae4b52](https://github.com/Alwatr/nanotron/commit/7ae4b52e6fc26df56a14ab680ba34f819f88901a)) by @mohammadhonarvar
|
|
21
|
+
|
|
22
|
+
### Code Refactoring
|
|
23
|
+
|
|
24
|
+
* update `import`s & packages based on the latest changes of `nanolib` ([7652b5d](https://github.com/Alwatr/nanotron/commit/7652b5d9cc69218f2ff28bda3d0d8f52f147c6f6)) by @mohammadhonarvar
|
|
25
|
+
|
|
26
|
+
### Miscellaneous Chores
|
|
27
|
+
|
|
28
|
+
* edited README ([d707d38](https://github.com/Alwatr/nanotron/commit/d707d389e085dd320402521cb23af5805013d777)) by @ArmanAsadian
|
|
29
|
+
|
|
30
|
+
### Dependencies update
|
|
31
|
+
|
|
32
|
+
* update ([834ffcc](https://github.com/Alwatr/nanotron/commit/834ffcc8f6de96cc11a1a6fa933f948b7813cde6)) by @mohammadhonarvar
|
|
33
|
+
|
|
6
34
|
## [4.2.2](https://github.com/Alwatr/nanotron/compare/v4.2.1...v4.2.2) (2024-09-29)
|
|
7
35
|
|
|
8
36
|
### Miscellaneous Chores
|
package/README.md
CHANGED
|
@@ -55,7 +55,7 @@ apiServer.defineRoute({
|
|
|
55
55
|
|
|
56
56
|
## Sponsors
|
|
57
57
|
|
|
58
|
-
The following companies, organizations, and individuals support
|
|
58
|
+
The following companies, organizations, and individuals support Nanotron ongoing maintenance and development. Become a Sponsor to get your logo on our README and website.
|
|
59
59
|
|
|
60
60
|
[](https://exirstudio.com)
|
|
61
61
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { NanotronServerResponse } from './api-server-response.js';
|
|
2
2
|
import type { DefineRouteOption, HttpRequestHeaders, NativeClientRequest, NativeServerResponse } from './type.js';
|
|
3
3
|
import type { NanotronUrl } from './url.js';
|
|
4
|
-
|
|
5
|
-
export declare class NanotronClientRequest<TSharedMeta extends Dictionary = Dictionary> {
|
|
4
|
+
export declare class NanotronClientRequest<TSharedMeta extends DictionaryOpt = DictionaryOpt> {
|
|
6
5
|
readonly url: NanotronUrl;
|
|
7
6
|
readonly serverResponse: NanotronServerResponse;
|
|
8
7
|
readonly routeOption: Required<DefineRouteOption> | null;
|
|
@@ -25,7 +24,7 @@ export declare class NanotronClientRequest<TSharedMeta extends Dictionary = Dict
|
|
|
25
24
|
readonly remoteAddress: string | null;
|
|
26
25
|
get headers(): HttpRequestHeaders;
|
|
27
26
|
private queryParams__?;
|
|
28
|
-
get queryParams():
|
|
27
|
+
get queryParams(): DictionaryOpt<string>;
|
|
29
28
|
constructor(url: NanotronUrl, nativeClientRequest: NativeClientRequest, nativeServerResponse: NativeServerResponse, routeOption: Required<DefineRouteOption> | null);
|
|
30
29
|
getBodyRaw(): Promise<Buffer>;
|
|
31
30
|
private getRemoteAddress__;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-client-request.d.ts","sourceRoot":"","sources":["../src/api-client-request.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,sBAAsB,EAAC,MAAM,0BAA0B,CAAC;AAGhE,OAAO,KAAK,EAAC,iBAAiB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,oBAAoB,EAAC,MAAM,WAAW,CAAC;AAChH,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"api-client-request.d.ts","sourceRoot":"","sources":["../src/api-client-request.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,sBAAsB,EAAC,MAAM,0BAA0B,CAAC;AAGhE,OAAO,KAAK,EAAC,iBAAiB,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,oBAAoB,EAAC,MAAM,WAAW,CAAC;AAChH,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,UAAU,CAAC;AAE1C,qBAAa,qBAAqB,CAAC,WAAW,SAAS,aAAa,GAAG,aAAa;IAClF,QAAQ,CAAC,GAAG,EAAE,WAAW,CAAC;IAE1B,QAAQ,CAAC,cAAc,EAAE,sBAAsB,CAAC;IAEhD,QAAQ,CAAC,WAAW,EAAE,QAAQ,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC;IAEzD;;;;;;;;;;;OAWG;IACH,kBAAkB,CAAC,EAAE,IAAI,CAAC;IAE1B,QAAQ,CAAC,UAAU,EAAE,WAAW,CAAqB;IAErD,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IAEnC,SAAS,CAAC,QAAQ,CAAC,OAAO,wCAAC;IAE3B,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAEtC,IAAI,OAAO,IAAI,kBAAkB,CAEhC;IAED,OAAO,CAAC,aAAa,CAAC,CAAwB;IAC9C,IAAI,WAAW,IAAI,aAAa,CAAC,MAAM,CAAC,CAQvC;gBAGC,GAAG,EAAE,WAAW,EAChB,mBAAmB,EAAE,mBAAmB,EACxC,oBAAoB,EAAE,oBAAoB,EAC1C,WAAW,EAAE,QAAQ,CAAC,iBAAiB,CAAC,GAAG,IAAI;IAkBjD,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAwE7B,OAAO,CAAC,kBAAkB;CAG3B"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type HttpStatusCode } from './const.js';
|
|
2
2
|
import type { NanotronClientRequest } from './api-client-request.js';
|
|
3
3
|
import type { HttpResponseHeaders, ErrorResponse, NativeServerResponse } from './type.js';
|
|
4
|
-
import type { Json } from '@alwatr/type-helper';
|
|
5
4
|
/**
|
|
6
5
|
* Configuration options for the Nanotron Api Server Response.
|
|
7
6
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-server-response.d.ts","sourceRoot":"","sources":["../src/api-server-response.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,KAAK,cAAc,EAAsC,MAAM,YAAY,CAAC;AAEpF,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAC,mBAAmB,EAAE,aAAa,EAAE,oBAAoB,EAAC,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"api-server-response.d.ts","sourceRoot":"","sources":["../src/api-server-response.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,KAAK,cAAc,EAAsC,MAAM,YAAY,CAAC;AAEpF,OAAO,KAAK,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAC,mBAAmB,EAAE,aAAa,EAAE,oBAAoB,EAAC,MAAM,WAAW,CAAC;AAExF;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,aAAa,EAAE,qBAAqB,CAAC;CACtC;AAED,qBAAa,sBAAsB;IACjC,QAAQ,CAAC,aAAa,EAAE,qBAAqB,CAAC;IAE9C,QAAQ,CAAC,IAAI,EAAE,oBAAoB,CAAC;IAEpC,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;IAEtC,SAAS,CAAC,QAAQ,CAAC,OAAO,wCAAC;IAE3B,SAAS,CAAC,YAAY,UAAS;IAC/B,IAAI,WAAW,IAAI,OAAO,CAEzB;gBAEW,qBAAqB,EAAE,qBAAqB,EAAE,oBAAoB,EAAE,oBAAoB;IAgBpG,IAAI,UAAU,IAAI,cAAc,CAE/B;IAED,IAAI,UAAU,CAAC,KAAK,EAAE,cAAc,EAEnC;IAED,SAAS,CAAC,aAAa;IAOvB,kBAAkB,CAAC,aAAa,EAAE,aAAa,GAAG,IAAI;IAsBtD,UAAU,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,IAAI,GAAG,OAAO,GAAG,IAAI;IAoCzD,SAAS,CAAC,YAAY,EAAE,IAAI,GAAG,IAAI;IAsBnC,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI;CAmCtC"}
|
package/dist/api-server.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { NanotronUrl } from './url.js';
|
|
2
2
|
import type { DefineRouteOption, MatchType, NativeClientRequest, NativeServerResponse } from './type.js';
|
|
3
|
-
import type { Dictionary } from '@alwatr/type-helper';
|
|
4
3
|
import type { Duplex } from 'node:stream';
|
|
5
4
|
/**
|
|
6
5
|
* Configuration options for the NanotronApiServer.
|
|
@@ -78,14 +77,15 @@ export declare class NanotronApiServer {
|
|
|
78
77
|
};
|
|
79
78
|
protected readonly logger_: import("@alwatr/logger").AlwatrLogger;
|
|
80
79
|
readonly httpServer: import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>;
|
|
81
|
-
protected readonly routeHandlerList__: Record<MatchType,
|
|
80
|
+
protected readonly routeHandlerList__: Record<MatchType, DictionaryOpt<DictionaryOpt<Required<DefineRouteOption>>>>;
|
|
82
81
|
constructor(config?: Partial<NanotronApiServerConfig>);
|
|
83
82
|
close(): void;
|
|
84
83
|
protected getRouteOption_(url: NanotronUrl): Required<DefineRouteOption> | null;
|
|
85
84
|
protected setRouteOption_(option: Required<DefineRouteOption>): void;
|
|
86
|
-
defineRoute<TSharedMeta extends
|
|
85
|
+
defineRoute<TSharedMeta extends DictionaryOpt = DictionaryOpt>(option: DefineRouteOption<TSharedMeta>): void;
|
|
87
86
|
protected handleServerError_(error: NodeJS.ErrnoException): void;
|
|
88
87
|
protected handleClientError_(err: NodeJS.ErrnoException, socket: Duplex): void;
|
|
89
88
|
protected handleClientRequest_(nativeClientRequest: NativeClientRequest, nativeServerResponse: NativeServerResponse): Promise<void>;
|
|
89
|
+
protected _defineHealthRoute(): void;
|
|
90
90
|
}
|
|
91
91
|
//# sourceMappingURL=api-server.d.ts.map
|
package/dist/api-server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-server.d.ts","sourceRoot":"","sources":["../src/api-server.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,WAAW,EAAC,MAAM,UAAU,CAAC;AAErC,OAAO,KAAK,EAAC,iBAAiB,EAAE,SAAS,EAAE,mBAAmB,EAAE,oBAAoB,EAAC,MAAM,WAAW,CAAC;
|
|
1
|
+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