@fluojs/platform-nodejs 1.0.0-beta.1 → 1.0.0-beta.2

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/README.ko.md CHANGED
@@ -10,6 +10,7 @@ fluo 런타임을 위한 raw Node.js HTTP 어댑터 패키지입니다.
10
10
  - [사용 시점](#사용-시점)
11
11
  - [빠른 시작](#빠른-시작)
12
12
  - [주요 패턴](#주요-패턴)
13
+ - [동작 계약](#동작-계약)
13
14
  - [공개 API 개요](#공개-api-개요)
14
15
  - [관련 패키지](#관련-패키지)
15
16
  - [예제 소스](#예제-소스)
@@ -68,15 +69,28 @@ import { AppModule } from './app.module';
68
69
  await runNodejsApplication(AppModule, {
69
70
  port: 3000,
70
71
  globalPrefix: 'api',
72
+ shutdownSignals: ['SIGINT', 'SIGTERM'],
71
73
  });
72
74
  ```
73
75
 
76
+ ## 동작 계약
77
+
78
+ - `createNodejsAdapter(options)`는 Node 내장 `http` 또는 `https` 서버 primitive 위에서 fluo를 직접 실행하는 adapter-first 진입점입니다.
79
+ - `maxBodySize`는 raw Node 요청 바이트가 아직 스트리밍되는 동안 강제되며, 부트스트랩/실행 헬퍼에서 `multipart.maxTotalSize`를 명시적으로 제공하지 않으면 멀티파트 전체 크기 한도의 기본값이 됩니다.
80
+ - `bootstrapNodejsApplication(module, options)`는 raw Node 어댑터가 포함된 애플리케이션을 만들지만 리스닝은 시작하지 않으므로 이후 `app.listen()`과 `app.close()` 생명주기는 호출자가 소유합니다.
81
+ - `runNodejsApplication(module, options)`는 부트스트랩, 리스닝 시작, graceful shutdown 배선을 함께 수행합니다. 시그널 기반 종료가 타임아웃되거나 실패하면 해당 상태를 로그와 `process.exitCode`로 보고하며, 최종 프로세스 종료는 호스트 프로세스가 계속 소유합니다.
82
+ - 고급 압축 및 shutdown 유틸리티 함수는 이 기본 platform startup surface가 아니라 `@fluojs/runtime/node` 또는 runtime 내부 seam에 남아 있습니다.
83
+
74
84
  ## 공개 API 개요
75
85
 
76
86
  - `createNodejsAdapter(options)`: raw Node.js HTTP 어댑터를 위한 기본 팩토리입니다.
77
87
  - `bootstrapNodejsApplication(module, options)`: 리스너를 시작하지 않고 애플리케이션 인스턴스를 생성합니다.
78
88
  - `runNodejsApplication(module, options)`: 생명주기 관리를 포함하여 애플리케이션을 부트스트랩하고 시작합니다.
89
+ - `BootstrapNodejsApplicationOptions`: bootstrap-only Node.js 애플리케이션 생성 옵션입니다.
90
+ - `NodejsAdapterOptions`: `port`, `host`, `https`, `maxBodySize`, retry 설정, raw body 보존, shutdown timeout을 포함하는 `createNodejsAdapter(...)`의 transport-level 옵션입니다.
91
+ - `NodejsApplicationSignal`: `runNodejsApplication(...)` shutdown 등록이 지원하는 시그널 이름입니다.
79
92
  - `NodejsHttpApplicationAdapter`: `createNodejsAdapter(...)`가 반환하는 어댑터 인스턴스를 설명하는 타입 전용 별칭이며, `@fluojs/runtime/node`가 공개하는 어댑터 surface를 그대로 보존합니다.
93
+ - `RunNodejsApplicationOptions`: 부트스트랩, 리스닝 시작, graceful shutdown 배선을 한 번에 수행하기 위한 옵션입니다.
80
94
 
81
95
  ## 관련 패키지
82
96
 
package/README.md CHANGED
@@ -10,6 +10,7 @@ Raw Node.js HTTP adapter package for the fluo runtime.
10
10
  - [When to Use](#when-to-use)
11
11
  - [Quick Start](#quick-start)
12
12
  - [Common Patterns](#common-patterns)
13
+ - [Behavioral Contracts](#behavioral-contracts)
13
14
  - [Public API Overview](#public-api-overview)
14
15
  - [Related Packages](#related-packages)
15
16
  - [Example Sources](#example-sources)
@@ -68,15 +69,28 @@ import { AppModule } from './app.module';
68
69
  await runNodejsApplication(AppModule, {
69
70
  port: 3000,
70
71
  globalPrefix: 'api',
72
+ shutdownSignals: ['SIGINT', 'SIGTERM'],
71
73
  });
72
74
  ```
73
75
 
76
+ ## Behavioral Contracts
77
+
78
+ - `createNodejsAdapter(options)` is the adapter-first entrypoint for running fluo directly on Node's built-in `http` or `https` server primitives.
79
+ - `maxBodySize` is enforced while raw Node request bytes are still streaming, and it becomes the default multipart total-size cap unless `multipart.maxTotalSize` is explicitly provided through the bootstrap/run helpers.
80
+ - `bootstrapNodejsApplication(module, options)` creates an application with the raw Node adapter but does not start listening, so the caller owns the subsequent `app.listen()` and `app.close()` lifecycle.
81
+ - `runNodejsApplication(module, options)` bootstraps, starts, and wires graceful shutdown. When signal-driven shutdown times out or fails, it logs the condition and sets `process.exitCode`; final process termination remains owned by the host process.
82
+ - Advanced compression and shutdown utility functions remain on `@fluojs/runtime/node` or internal runtime seams rather than this primary platform startup surface.
83
+
74
84
  ## Public API Overview
75
85
 
76
86
  - `createNodejsAdapter(options)`: Primary factory for the raw Node.js HTTP adapter.
77
87
  - `bootstrapNodejsApplication(module, options)`: Creates an application instance without starting the listener.
78
88
  - `runNodejsApplication(module, options)`: Bootstraps and starts the application with lifecycle management.
89
+ - `BootstrapNodejsApplicationOptions`: Options for bootstrap-only Node.js application creation.
90
+ - `NodejsAdapterOptions`: Transport-level options for `createNodejsAdapter(...)`, including `port`, `host`, `https`, `maxBodySize`, retry settings, raw body preservation, and shutdown timeout.
91
+ - `NodejsApplicationSignal`: Supported signal names for `runNodejsApplication(...)` shutdown registration.
79
92
  - `NodejsHttpApplicationAdapter`: Type-only alias describing the adapter instances returned by `createNodejsAdapter(...)`, while preserving the public adapter surface exported from `@fluojs/runtime/node`.
93
+ - `RunNodejsApplicationOptions`: Options for one-call bootstrap, listen, and graceful shutdown wiring.
80
94
 
81
95
  ## Related Packages
82
96
 
package/dist/index.d.ts CHANGED
@@ -1,11 +1,84 @@
1
- import { type NodeHttpAdapterOptions, type NodeHttpApplicationAdapter } from '@fluojs/runtime/node';
2
- export { bootstrapNodeApplication as bootstrapNodejsApplication, runNodeApplication as runNodejsApplication, } from '@fluojs/runtime/node';
3
- export type { BootstrapNodeApplicationOptions as BootstrapNodejsApplicationOptions, NodeApplicationSignal as NodejsApplicationSignal, NodeHttpAdapterOptions as NodejsAdapterOptions, NodeHttpApplicationAdapter as NodejsHttpApplicationAdapter, RunNodeApplicationOptions as RunNodejsApplicationOptions, } from '@fluojs/runtime/node';
1
+ import { type BootstrapNodeApplicationOptions, bootstrapNodeApplication, type NodeApplicationSignal, type NodeHttpAdapterOptions, type NodeHttpApplicationAdapter, type RunNodeApplicationOptions, runNodeApplication } from '@fluojs/runtime/node';
2
+ /**
3
+ * Options accepted by `bootstrapNodejsApplication(...)` before the listener starts.
4
+ *
5
+ * @remarks
6
+ * This type mirrors the supported Node application bootstrap options from `@fluojs/runtime/node`
7
+ * while keeping the `@fluojs/platform-nodejs` public surface documented at its package boundary.
8
+ */
9
+ export type BootstrapNodejsApplicationOptions = BootstrapNodeApplicationOptions;
10
+ /**
11
+ * POSIX signals that `runNodejsApplication(...)` can subscribe to for graceful shutdown.
12
+ *
13
+ * @remarks
14
+ * Pass `false` to `RunNodejsApplicationOptions.shutdownSignals` when the host process owns signal
15
+ * registration and should call `app.close()` itself.
16
+ */
17
+ export type NodejsApplicationSignal = NodeApplicationSignal;
18
+ /**
19
+ * Transport-level settings for the raw Node.js adapter factory.
20
+ *
21
+ * @remarks
22
+ * `maxBodySize` is enforced while request bytes stream in and also seeds the multipart total-size
23
+ * limit unless `bootstrapNodejsApplication(...)` or `runNodejsApplication(...)` provides an
24
+ * explicit `multipart.maxTotalSize` value.
25
+ */
26
+ export type NodejsAdapterOptions = NodeHttpAdapterOptions;
27
+ /**
28
+ * Adapter instance returned by `createNodejsAdapter(...)`.
29
+ *
30
+ * @remarks
31
+ * The alias preserves the public `@fluojs/runtime/node` adapter contract, including access to the
32
+ * underlying Node server via `getServer()` for server-backed realtime integrations.
33
+ */
34
+ export type NodejsHttpApplicationAdapter = NodeHttpApplicationAdapter;
35
+ /**
36
+ * Options accepted by `runNodejsApplication(...)` for one-call bootstrap, listen, and shutdown wiring.
37
+ *
38
+ * @remarks
39
+ * Signal-driven shutdown logs timeout or failure conditions and sets `process.exitCode`, but final
40
+ * process termination remains owned by the surrounding host runtime.
41
+ */
42
+ export type RunNodejsApplicationOptions = RunNodeApplicationOptions;
43
+ /**
44
+ * Bootstrap a fluo module with the raw Node.js adapter without starting the listener.
45
+ *
46
+ * @remarks
47
+ * This alias keeps the package-level Node.js naming convention while delegating to the supported
48
+ * `@fluojs/runtime/node` implementation.
49
+ *
50
+ * @param rootModule Root fluo module to bootstrap.
51
+ * @param options Node.js bootstrap options applied before the listener starts.
52
+ * @returns A fluo application instance whose listener is not started yet.
53
+ */
54
+ export declare const bootstrapNodejsApplication: typeof bootstrapNodeApplication;
4
55
  /**
5
56
  * Create the raw Node.js HTTP adapter exposed by `@fluojs/platform-nodejs`.
6
57
  *
58
+ * @remarks
59
+ * Use this factory for adapter-first startup through `fluoFactory.create(...)` when the application
60
+ * should run directly on Node's built-in `http` or `https` server primitives.
61
+ *
7
62
  * @param options Transport-level Node.js settings such as port, retries, multipart, and HTTPS options.
8
63
  * @returns The Node.js HTTP adapter instance used by the Fluo runtime.
64
+ *
65
+ * @example
66
+ * ```ts
67
+ * const adapter = createNodejsAdapter({ port: 3000 });
68
+ * ```
9
69
  */
10
70
  export declare function createNodejsAdapter(options?: NodeHttpAdapterOptions): NodeHttpApplicationAdapter;
71
+ /**
72
+ * Bootstrap and start a fluo module on the raw Node.js adapter with lifecycle shutdown wiring.
73
+ *
74
+ * @remarks
75
+ * This alias is the zero-boilerplate package entrypoint for Node.js hosts. It preserves the runtime
76
+ * helper behavior: graceful shutdown is bounded and reported, while final process exit remains under
77
+ * host ownership.
78
+ *
79
+ * @param rootModule Root fluo module to bootstrap and start.
80
+ * @param options Node.js run options, including optional shutdown signal ownership.
81
+ * @returns A started fluo application instance.
82
+ */
83
+ export declare const runNodejsApplication: typeof runNodeApplication;
11
84
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,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@@ -1,11 +1,88 @@
1
- import { createNodeHttpAdapter } from '@fluojs/runtime/node';
2
- export { bootstrapNodeApplication as bootstrapNodejsApplication, runNodeApplication as runNodejsApplication } from '@fluojs/runtime/node';
1
+ import { bootstrapNodeApplication, createNodeHttpAdapter, runNodeApplication } from '@fluojs/runtime/node';
2
+
3
+ /**
4
+ * Options accepted by `bootstrapNodejsApplication(...)` before the listener starts.
5
+ *
6
+ * @remarks
7
+ * This type mirrors the supported Node application bootstrap options from `@fluojs/runtime/node`
8
+ * while keeping the `@fluojs/platform-nodejs` public surface documented at its package boundary.
9
+ */
10
+
11
+ /**
12
+ * POSIX signals that `runNodejsApplication(...)` can subscribe to for graceful shutdown.
13
+ *
14
+ * @remarks
15
+ * Pass `false` to `RunNodejsApplicationOptions.shutdownSignals` when the host process owns signal
16
+ * registration and should call `app.close()` itself.
17
+ */
18
+
19
+ /**
20
+ * Transport-level settings for the raw Node.js adapter factory.
21
+ *
22
+ * @remarks
23
+ * `maxBodySize` is enforced while request bytes stream in and also seeds the multipart total-size
24
+ * limit unless `bootstrapNodejsApplication(...)` or `runNodejsApplication(...)` provides an
25
+ * explicit `multipart.maxTotalSize` value.
26
+ */
27
+
28
+ /**
29
+ * Adapter instance returned by `createNodejsAdapter(...)`.
30
+ *
31
+ * @remarks
32
+ * The alias preserves the public `@fluojs/runtime/node` adapter contract, including access to the
33
+ * underlying Node server via `getServer()` for server-backed realtime integrations.
34
+ */
35
+
36
+ /**
37
+ * Options accepted by `runNodejsApplication(...)` for one-call bootstrap, listen, and shutdown wiring.
38
+ *
39
+ * @remarks
40
+ * Signal-driven shutdown logs timeout or failure conditions and sets `process.exitCode`, but final
41
+ * process termination remains owned by the surrounding host runtime.
42
+ */
43
+
44
+ /**
45
+ * Bootstrap a fluo module with the raw Node.js adapter without starting the listener.
46
+ *
47
+ * @remarks
48
+ * This alias keeps the package-level Node.js naming convention while delegating to the supported
49
+ * `@fluojs/runtime/node` implementation.
50
+ *
51
+ * @param rootModule Root fluo module to bootstrap.
52
+ * @param options Node.js bootstrap options applied before the listener starts.
53
+ * @returns A fluo application instance whose listener is not started yet.
54
+ */
55
+ export const bootstrapNodejsApplication = bootstrapNodeApplication;
56
+
3
57
  /**
4
58
  * Create the raw Node.js HTTP adapter exposed by `@fluojs/platform-nodejs`.
5
59
  *
60
+ * @remarks
61
+ * Use this factory for adapter-first startup through `fluoFactory.create(...)` when the application
62
+ * should run directly on Node's built-in `http` or `https` server primitives.
63
+ *
6
64
  * @param options Transport-level Node.js settings such as port, retries, multipart, and HTTPS options.
7
65
  * @returns The Node.js HTTP adapter instance used by the Fluo runtime.
66
+ *
67
+ * @example
68
+ * ```ts
69
+ * const adapter = createNodejsAdapter({ port: 3000 });
70
+ * ```
8
71
  */
9
72
  export function createNodejsAdapter(options = {}) {
10
73
  return createNodeHttpAdapter(options);
11
- }
74
+ }
75
+
76
+ /**
77
+ * Bootstrap and start a fluo module on the raw Node.js adapter with lifecycle shutdown wiring.
78
+ *
79
+ * @remarks
80
+ * This alias is the zero-boilerplate package entrypoint for Node.js hosts. It preserves the runtime
81
+ * helper behavior: graceful shutdown is bounded and reported, while final process exit remains under
82
+ * host ownership.
83
+ *
84
+ * @param rootModule Root fluo module to bootstrap and start.
85
+ * @param options Node.js run options, including optional shutdown signal ownership.
86
+ * @returns A started fluo application instance.
87
+ */
88
+ export const runNodejsApplication = runNodeApplication;
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "platform",
10
10
  "server"
11
11
  ],
12
- "version": "1.0.0-beta.1",
12
+ "version": "1.0.0-beta.2",
13
13
  "private": false,
14
14
  "license": "MIT",
15
15
  "repository": {
@@ -37,7 +37,7 @@
37
37
  ],
38
38
  "dependencies": {
39
39
  "@fluojs/http": "^1.0.0-beta.1",
40
- "@fluojs/runtime": "^1.0.0-beta.1"
40
+ "@fluojs/runtime": "^1.0.0-beta.2"
41
41
  },
42
42
  "devDependencies": {
43
43
  "vitest": "^3.2.4"