@celerity-sdk/runtime 0.2.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/.env.test ADDED
@@ -0,0 +1,4 @@
1
+ CELERITY_VARIABLE_secretStoreId=test-secret-store
2
+ CELERITY_VARIABLE_certificateId=test-certificate
3
+ CELERITY_VARIABLE_logLevel=DEBUG
4
+ CELERITY_VARIABLE_paymentApiSecret=test-payment-api-secret
@@ -0,0 +1,4 @@
1
+ {
2
+ "editor.formatOnSave": true,
3
+ "rust-analyzer.procMacro.ignored": { "napi-derive": ["napi"] }
4
+ }
package/.yarnrc.yml ADDED
@@ -0,0 +1 @@
1
+ nodeLinker: node-modules
package/CHANGELOG.md ADDED
@@ -0,0 +1,15 @@
1
+ # Changelog
2
+
3
+ ## [0.2.0](https://github.com/newstack-cloud/celerity/compare/runtime-sdk-node/v0.1.0...runtime-sdk-node/v0.2.0) (2026-02-08)
4
+
5
+
6
+ ### Features
7
+
8
+ * **lib-rt-sdk-node:** add full support for http features ([6536d24](https://github.com/newstack-cloud/celerity/commit/6536d2495ba614178b661578a9f1f0fd15e899e2))
9
+
10
+ ## 1.0.0 (2026-02-08)
11
+
12
+
13
+ ### Features
14
+
15
+ * **lib-rt-sdk-node:** add full support for http features ([6536d24](https://github.com/newstack-cloud/celerity/commit/6536d2495ba614178b661578a9f1f0fd15e899e2))
@@ -0,0 +1,121 @@
1
+ # Contributing to Celerity Runtime SDK for Node.js
2
+
3
+ ## Prerequisites
4
+
5
+ - [Node.js](https://nodejs.org/) >=22.0.0
6
+ - [Rust](https://www.rust-lang.org/tools/install) >=1.76.0
7
+ - [Yarn](https://yarnpkg.com/) (will be installed via corepack)
8
+ - [Git](https://git-scm.com/)
9
+
10
+ ## Installation
11
+
12
+ 1. **Enable corepack (if not already enabled):**
13
+ ```bash
14
+ corepack enable
15
+ ```
16
+
17
+ 2. **Install dependencies:**
18
+ ```bash
19
+ yarn install
20
+ ```
21
+
22
+ ## Development
23
+
24
+ ### Building
25
+
26
+ Build the native module for all platforms:
27
+
28
+ ```bash
29
+ yarn build
30
+ ```
31
+
32
+ Build for a specific target:
33
+
34
+ ```bash
35
+ yarn build --target x86_64-apple-darwin
36
+ yarn build --target aarch64-unknown-linux-gnu
37
+ yarn build --target x86_64-pc-windows-msvc
38
+ ```
39
+
40
+ ### Running Tests
41
+
42
+ ```bash
43
+ yarn test
44
+ ```
45
+
46
+ ### Development Build
47
+
48
+ For faster iteration during development:
49
+
50
+ ```bash
51
+ yarn build:debug
52
+ ```
53
+
54
+ ## Releasing
55
+
56
+ To release a new version of the Node.js Runtime SDK, follow these steps:
57
+
58
+ ### Pre-Release Checklist:
59
+
60
+ 1. **Update Version in package.json**
61
+ ```bash
62
+ # Edit libs/runtime/sdk/node/package.json
63
+ # Change the version field to match your release
64
+ "version": "1.2.3"
65
+ ```
66
+
67
+ 2. **Update Version in Cargo.toml**
68
+ ```bash
69
+ # Edit libs/runtime/sdk/node/Cargo.toml
70
+ # Change the version field to match your release
71
+ version = "1.2.3"
72
+ ```
73
+
74
+ 3. **Commit the Version Changes**
75
+ ```bash
76
+ git add libs/runtime/sdk/node/package.json libs/runtime/sdk/node/Cargo.toml
77
+ git commit -m "chore(lib-rt-sdk-node): bump version to 1.2.3"
78
+ git push origin main
79
+ ```
80
+
81
+ 4. **Create and Push Release Tag**
82
+ ```bash
83
+ # Note: Use 'v' prefix in the tag name
84
+ git tag -a libs/runtime/sdk/node-v1.2.3 -m "Release Celerity Runtime SDK for Node.js v1.2.3"
85
+ git push origin libs/runtime/sdk/node-v1.2.3
86
+ ```
87
+
88
+ ### Version Format Guidelines:
89
+
90
+ - **package.json**: Use `"1.2.3"` (no 'v' prefix)
91
+ - **Cargo.toml**: Use `1.2.3` (no 'v' prefix)
92
+ - **Git Tags**: Use `libs/runtime/sdk/node-v1.2.3` (with 'v' prefix)
93
+ - **NPM Package**: Will be published as `@celerity-sdk/runtime 1.2.3`
94
+
95
+ ### What Happens After Tagging:
96
+
97
+ 1. **CI/CD Pipeline**: The GitHub Actions workflow will automatically:
98
+ - Build native modules for all supported platforms
99
+ - Run tests across multiple Node.js versions and platforms
100
+ - Extract version from tag (e.g., `v1.2.3` from `libs/runtime/sdk/node-v1.2.3`)
101
+ - Publish to NPM as `@celerity-sdk/runtime 1.2.3`
102
+
103
+ 2. **Verification**: Check that the package is available on NPM:
104
+ ```bash
105
+ npm install @celerity-sdk/runtime@1.2.3
106
+ ```
107
+
108
+ ### Supported Platforms:
109
+
110
+ The SDK is built and tested for the following platforms:
111
+
112
+ - **macOS**: x86_64, aarch64 (Apple Silicon)
113
+ - **Linux**: x86_64 (GNU), x86_64 (musl), aarch64 (GNU), aarch64 (musl)
114
+ - **Windows**: x86_64, aarch64
115
+ - **FreeBSD**: x86_64
116
+
117
+ ### Important Notes:
118
+
119
+ - All tests must pass before the package is published
120
+ - Cross-platform compatibility is verified automatically
121
+ - The published package version will be clean (no monorepo prefixes)
package/Cargo.toml ADDED
@@ -0,0 +1,38 @@
1
+ [package]
2
+ edition = "2021"
3
+ name = "celerityjs-runtime-sdk"
4
+ version = "0.0.0"
5
+ license.workspace = true
6
+
7
+ [lib]
8
+ crate-type = ["cdylib"]
9
+
10
+ [dependencies]
11
+ # Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
12
+ napi = { version = "3.8", default-features = false, features = [
13
+ "napi4",
14
+ "async",
15
+ "serde-json",
16
+ ] }
17
+ napi-derive = "3"
18
+ tokio = "1.39.2"
19
+ axum = "0.8.4"
20
+ serde = "1.0.204"
21
+ serde_json = "1.0.122"
22
+ chrono = "0.4"
23
+ tracing = "0.1.40"
24
+ tracing-core = "0.1.32"
25
+ tracing-subscriber = { version = "0.3.20", features = ["chrono", "json"] }
26
+
27
+ [dependencies.celerity_runtime_core]
28
+ path = "../../core"
29
+
30
+ [dependencies.celerity_helpers]
31
+ path = "../../helpers"
32
+
33
+ [build-dependencies]
34
+ napi-build = "2"
35
+
36
+ [profile.release]
37
+ lto = true
38
+ strip = "symbols"
package/README.md ADDED
@@ -0,0 +1,7 @@
1
+ # Celerity Runtime SDK for Node.js
2
+
3
+ This is the Celerity Runtime SDK for Node.js. It provides a set of APIs to launch
4
+ and interact with a Celerity Runtime application.
5
+
6
+ This is a low-level library that in most cases does not need to be used directly. Instead,
7
+ you should use the higher-level SDKs such as `@celerity-sdk/handlers`.
package/build.rs ADDED
@@ -0,0 +1,3 @@
1
+ fn main() {
2
+ napi_build::setup();
3
+ }
package/index.d.ts ADDED
@@ -0,0 +1,96 @@
1
+ /* auto-generated by NAPI-RS */
2
+ /* eslint-disable */
3
+ export declare class CoreRuntimeApplication {
4
+ constructor(runtimeConfig: CoreRuntimeConfig)
5
+ setup(): CoreRuntimeAppConfig
6
+ registerHttpHandler(path: string, method: string, timeoutSeconds: number | undefined | null, handler: (err: Error | null, request: Request) => Promise<Response>): void
7
+ run(block: boolean): Promise<void>
8
+ shutdown(): void
9
+ }
10
+
11
+ export declare class Request {
12
+ /**
13
+ * Allows the creation of requests, primarily for test purposes.
14
+ * In normal circumstances, the request will be created by
15
+ * the runtime and passed to the handler.
16
+ */
17
+ constructor(method: string, uri: string, headers: Record<string, string>)
18
+ /** The HTTP version used for the request. */
19
+ get httpVersion(): string
20
+ /** The HTTP method of the request. */
21
+ get method(): string
22
+ /** The URI of the request. */
23
+ get uri(): string
24
+ /** The headers of the request as a map of header name to list of values. */
25
+ get headers(): Record<string, Array<string>>
26
+ /** The path of the request (e.g. "/orders/123"). */
27
+ get path(): string
28
+ /** Path parameters extracted from the URL (e.g. { "orderId": "123" }). */
29
+ get pathParams(): Record<string, string>
30
+ /** Query parameters, supporting multiple values per key. */
31
+ get query(): Record<string, Array<string>>
32
+ /** Cookies from the request. */
33
+ get cookies(): Record<string, string>
34
+ /** The content type of the request body. */
35
+ get contentType(): string
36
+ /** The request ID (from x-request-id header or auto-generated). */
37
+ get requestId(): string
38
+ /** The request time as an ISO 8601 string. */
39
+ get requestTime(): string
40
+ /** Authentication claims from the auth middleware, or null if no auth. */
41
+ get auth(): any | null
42
+ /** The client IP address resolved by the runtime. */
43
+ get clientIp(): string
44
+ /**
45
+ * The trace context for distributed tracing propagation.
46
+ * Contains "traceparent" (W3C) and optionally "xray_trace_id" (AWS).
47
+ */
48
+ get traceContext(): Record<string, string> | null
49
+ /** The user-agent string from the request. */
50
+ get userAgent(): string
51
+ /** The matched route pattern (e.g. "/orders/{orderId}"), or null if unavailable. */
52
+ get matchedRoute(): string | null
53
+ /** The text body of the request, or null if the body is empty or binary. */
54
+ get textBody(): string | null
55
+ /** The binary body of the request as a Buffer, or null if the body is empty or text. */
56
+ get binaryBody(): Buffer | null
57
+ }
58
+ export type JsRequestWrapper = Request
59
+
60
+ export interface CoreApiConfig {
61
+ http?: CoreHttpConfig
62
+ websocket?: CoreWebsocketConfig
63
+ }
64
+
65
+ export interface CoreHttpConfig {
66
+ handlers: Array<CoreHttpHandlerDefinition>
67
+ }
68
+
69
+ export interface CoreHttpHandlerDefinition {
70
+ path: string
71
+ method: string
72
+ location: string
73
+ handler: string
74
+ timeout: number
75
+ }
76
+
77
+ export interface CoreRuntimeAppConfig {
78
+ api?: CoreApiConfig
79
+ }
80
+
81
+ export interface CoreRuntimeConfig {
82
+ blueprintConfigPath: string
83
+ serverPort: number
84
+ serverLoopbackOnly?: boolean
85
+ }
86
+
87
+ export interface CoreWebsocketConfig {
88
+
89
+ }
90
+
91
+ export interface Response {
92
+ status: number
93
+ headers?: Record<string, string>
94
+ body?: string
95
+ binaryBody?: Buffer
96
+ }