@rivetkit/rivetkit-napi 0.0.0-fix-engine-autospawn-binary-path.e5bdda7 → 0.0.0-http-body-streaming.6d1723c
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/index.d.ts +21 -0
- package/index.js +3 -1
- package/package.json +10 -9
- package/scripts/build.mjs +8 -0
package/index.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export interface JsHttpResponse {
|
|
|
39
39
|
status?: number
|
|
40
40
|
headers?: Record<string, string>
|
|
41
41
|
body?: Buffer
|
|
42
|
+
stream?: boolean
|
|
42
43
|
}
|
|
43
44
|
export interface JsQueueSendResult {
|
|
44
45
|
status: string
|
|
@@ -187,6 +188,16 @@ export interface JsServeConfig {
|
|
|
187
188
|
serverlessValidateEndpoint: boolean
|
|
188
189
|
serverlessMaxStartPayloadBytes: number
|
|
189
190
|
}
|
|
191
|
+
export interface JsListenerConfig {
|
|
192
|
+
/** Host to bind. Defaults to `0.0.0.0` when not provided. */
|
|
193
|
+
host?: string
|
|
194
|
+
port: number
|
|
195
|
+
/**
|
|
196
|
+
* Optional static file root mounted as a fallback below the framework
|
|
197
|
+
* routes.
|
|
198
|
+
*/
|
|
199
|
+
publicDir?: string
|
|
200
|
+
}
|
|
190
201
|
export interface JsServerlessRequest {
|
|
191
202
|
method: string
|
|
192
203
|
url: string
|
|
@@ -270,6 +281,15 @@ export declare class ActorContext {
|
|
|
270
281
|
runtimeState(): object
|
|
271
282
|
clearRuntimeState(): void
|
|
272
283
|
}
|
|
284
|
+
export declare class HttpResponseBodyStream {
|
|
285
|
+
write(chunk: Buffer): Promise<void>
|
|
286
|
+
end(): Promise<void>
|
|
287
|
+
error(message: string): Promise<void>
|
|
288
|
+
}
|
|
289
|
+
export declare class HttpRequestBodyStream {
|
|
290
|
+
read(): Promise<Buffer | null>
|
|
291
|
+
cancel(): Promise<void>
|
|
292
|
+
}
|
|
273
293
|
export declare class NapiActorFactory {
|
|
274
294
|
constructor(callbacks: object, config?: JsActorConfig | undefined | null)
|
|
275
295
|
}
|
|
@@ -344,6 +364,7 @@ export declare class CoreRegistry {
|
|
|
344
364
|
health(): Promise<JsRegistryRouteResponse>
|
|
345
365
|
metadata(): JsRegistryRouteResponse
|
|
346
366
|
metrics(): JsRegistryRouteResponse
|
|
367
|
+
serveListener(listener: JsListenerConfig, config: JsServeConfig): Promise<void>
|
|
347
368
|
handleServerlessRequest(req: JsServerlessRequest, onStreamEvent: (...args: any[]) => any, cancelToken: CancellationToken, config: JsServeConfig): Promise<JsServerlessResponseHead>
|
|
348
369
|
}
|
|
349
370
|
export declare class Schedule {
|
package/index.js
CHANGED
|
@@ -310,9 +310,11 @@ if (!nativeBinding) {
|
|
|
310
310
|
throw new Error(`Failed to load native binding`)
|
|
311
311
|
}
|
|
312
312
|
|
|
313
|
-
const { ActorContext, NapiActorFactory, CancellationToken, ConnHandle, JsNativeDatabase, Kv, Queue, QueueMessage, CoreRegistry, Schedule, WebSocket } = nativeBinding
|
|
313
|
+
const { ActorContext, HttpResponseBodyStream, HttpRequestBodyStream, NapiActorFactory, CancellationToken, ConnHandle, JsNativeDatabase, Kv, Queue, QueueMessage, CoreRegistry, Schedule, WebSocket } = nativeBinding
|
|
314
314
|
|
|
315
315
|
module.exports.ActorContext = ActorContext
|
|
316
|
+
module.exports.HttpResponseBodyStream = HttpResponseBodyStream
|
|
317
|
+
module.exports.HttpRequestBodyStream = HttpRequestBodyStream
|
|
316
318
|
module.exports.NapiActorFactory = NapiActorFactory
|
|
317
319
|
module.exports.CancellationToken = CancellationToken
|
|
318
320
|
module.exports.ConnHandle = ConnHandle
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rivetkit/rivetkit-napi",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-http-body-streaming.6d1723c",
|
|
4
4
|
"description": "Native N-API addon for RivetKit providing envoy client and SQLite access",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "index.js",
|
|
@@ -39,18 +39,19 @@
|
|
|
39
39
|
"build": "node scripts/build.mjs",
|
|
40
40
|
"build:release": "node scripts/build.mjs --release",
|
|
41
41
|
"build:force": "node scripts/build.mjs --force",
|
|
42
|
-
"build:force:release": "node scripts/build.mjs --force --release"
|
|
42
|
+
"build:force:release": "node scripts/build.mjs --force --release",
|
|
43
|
+
"build:embed": "node scripts/build.mjs"
|
|
43
44
|
},
|
|
44
45
|
"dependencies": {
|
|
45
46
|
"@napi-rs/cli": "^2.18.4",
|
|
46
|
-
"@rivetkit/engine-envoy-protocol": "0.0.0-
|
|
47
|
+
"@rivetkit/engine-envoy-protocol": "0.0.0-http-body-streaming.6d1723c"
|
|
47
48
|
},
|
|
48
49
|
"optionalDependencies": {
|
|
49
|
-
"@rivetkit/rivetkit-napi-darwin-arm64": "0.0.0-
|
|
50
|
-
"@rivetkit/rivetkit-napi-darwin-x64": "0.0.0-
|
|
51
|
-
"@rivetkit/rivetkit-napi-linux-arm64-gnu": "0.0.0-
|
|
52
|
-
"@rivetkit/rivetkit-napi-linux-arm64-musl": "0.0.0-
|
|
53
|
-
"@rivetkit/rivetkit-napi-linux-x64-gnu": "0.0.0-
|
|
54
|
-
"@rivetkit/rivetkit-napi-linux-x64-musl": "0.0.0-
|
|
50
|
+
"@rivetkit/rivetkit-napi-darwin-arm64": "0.0.0-http-body-streaming.6d1723c",
|
|
51
|
+
"@rivetkit/rivetkit-napi-darwin-x64": "0.0.0-http-body-streaming.6d1723c",
|
|
52
|
+
"@rivetkit/rivetkit-napi-linux-arm64-gnu": "0.0.0-http-body-streaming.6d1723c",
|
|
53
|
+
"@rivetkit/rivetkit-napi-linux-arm64-musl": "0.0.0-http-body-streaming.6d1723c",
|
|
54
|
+
"@rivetkit/rivetkit-napi-linux-x64-gnu": "0.0.0-http-body-streaming.6d1723c",
|
|
55
|
+
"@rivetkit/rivetkit-napi-linux-x64-musl": "0.0.0-http-body-streaming.6d1723c"
|
|
55
56
|
}
|
|
56
57
|
}
|
package/scripts/build.mjs
CHANGED
|
@@ -16,6 +16,14 @@ if (process.env.SKIP_NAPI_BUILD === "1") {
|
|
|
16
16
|
process.exit(0);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
// The per-actor inspector UI (frontend/dist/inspector-ui, embedded into
|
|
20
|
+
// rivetkit-core by its build.rs) must be built before this napi build runs.
|
|
21
|
+
// It is NOT built here: rivetkit-core's embed needs rivetkit/inspector-tab,
|
|
22
|
+
// which is downstream of this package in the build graph, so building it from
|
|
23
|
+
// the napi build would invert the dependency order. CI builds it via
|
|
24
|
+
// `turbo build:inspector-ui` in docker/build/*.Dockerfile before `napi build`;
|
|
25
|
+
// for local builds run `pnpm -F @rivetkit/engine-frontend build:inspector-ui`
|
|
26
|
+
// (or `turbo build:inspector-ui`) first.
|
|
19
27
|
const cmd = ["build", "--platform", ...extraFlags];
|
|
20
28
|
console.log(`[rivetkit-napi/build] running: napi ${cmd.join(" ")}`);
|
|
21
29
|
execFileSync("napi", cmd, { stdio: "inherit" });
|