@rivetkit/rivetkit-napi 2.3.7 → 2.3.8

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.
Files changed (3) hide show
  1. package/index.d.ts +26 -6
  2. package/index.js +3 -1
  3. package/package.json +9 -9
package/index.d.ts CHANGED
@@ -44,11 +44,6 @@ export interface JsInspectorSnapshot {
44
44
  export interface JsActorRuntimeSocketEndpointInfo {
45
45
  path: string
46
46
  }
47
- export interface JsHttpResponse {
48
- status?: number
49
- headers?: Record<string, string>
50
- body?: Buffer
51
- }
52
47
  export interface JsQueueSendResult {
53
48
  status: string
54
49
  response?: Buffer
@@ -146,6 +141,12 @@ export interface JsSqliteVfsMetrics {
146
141
  writeBufferDirtyPages: number
147
142
  dbSizePages: number
148
143
  }
144
+ export interface JsHttpResponse {
145
+ status?: number
146
+ headers?: Record<string, string>
147
+ body?: Buffer
148
+ stream?: boolean
149
+ }
149
150
  export interface JsQueueNextOptions {
150
151
  names?: Array<string>
151
152
  timeoutMs?: number
@@ -220,6 +221,12 @@ export interface JsServerlessResponseHead {
220
221
  status: number
221
222
  headers: Record<string, string>
222
223
  }
224
+ export interface JsApplicationResponse {
225
+ status: number
226
+ headers: Record<string, string>
227
+ body?: Buffer
228
+ stream?: boolean
229
+ }
223
230
  export interface JsRegistryRouteResponse {
224
231
  status: number
225
232
  headers: Record<string, string>
@@ -361,6 +368,18 @@ export declare class JsSqliteTransaction {
361
368
  commit(): Promise<void>
362
369
  rollback(): Promise<void>
363
370
  }
371
+ /** JavaScript-facing writer for a streaming actor HTTP response. */
372
+ export declare class HttpResponseBodyStream {
373
+ cancelled(): Promise<void>
374
+ write(chunk: Buffer): Promise<void>
375
+ end(): Promise<void>
376
+ error(message: string): Promise<void>
377
+ }
378
+ /** JavaScript-facing reader for a streaming actor HTTP request. */
379
+ export declare class HttpRequestBodyStream {
380
+ read(): Promise<Buffer | null>
381
+ cancel(): Promise<void>
382
+ }
364
383
  export declare class Kv {
365
384
  get(key: Buffer): Promise<Buffer | null>
366
385
  put(key: Buffer, value: Buffer): Promise<void>
@@ -416,7 +435,8 @@ export declare class CoreRegistry {
416
435
  health(): Promise<JsRegistryRouteResponse>
417
436
  metadata(): JsRegistryRouteResponse
418
437
  metrics(): JsRegistryRouteResponse
419
- serveListener(listener: JsListenerConfig, config: JsServeConfig): Promise<void>
438
+ serveApplicationListener(listener: JsListenerConfig, application: (...args: any[]) => any, config: JsServeConfig): Promise<void>
439
+ serveListener(listener: JsListenerConfig, config: JsServeConfig, application?: (...args: any[]) => any | undefined | null): Promise<void>
420
440
  handleServerlessRequest(req: JsServerlessRequest, onStreamEvent: (...args: any[]) => any, cancelToken: CancellationToken, config: JsServeConfig): Promise<JsServerlessResponseHead>
421
441
  }
422
442
  export declare class Schedule {
package/index.js CHANGED
@@ -310,7 +310,7 @@ if (!nativeBinding) {
310
310
  throw new Error(`Failed to load native binding`)
311
311
  }
312
312
 
313
- const { ActorContext, decodeInspectorRequest, encodeInspectorResponse, NapiActorFactory, CancellationToken, ConnHandle, JsNativeDatabase, JsSqliteTransaction, Kv, Queue, QueueMessage, CoreRegistry, Schedule, WebSocket } = nativeBinding
313
+ const { ActorContext, decodeInspectorRequest, encodeInspectorResponse, NapiActorFactory, CancellationToken, ConnHandle, JsNativeDatabase, JsSqliteTransaction, HttpResponseBodyStream, HttpRequestBodyStream, Kv, Queue, QueueMessage, CoreRegistry, Schedule, WebSocket } = nativeBinding
314
314
 
315
315
  module.exports.ActorContext = ActorContext
316
316
  module.exports.decodeInspectorRequest = decodeInspectorRequest
@@ -320,6 +320,8 @@ module.exports.CancellationToken = CancellationToken
320
320
  module.exports.ConnHandle = ConnHandle
321
321
  module.exports.JsNativeDatabase = JsNativeDatabase
322
322
  module.exports.JsSqliteTransaction = JsSqliteTransaction
323
+ module.exports.HttpResponseBodyStream = HttpResponseBodyStream
324
+ module.exports.HttpRequestBodyStream = HttpRequestBodyStream
323
325
  module.exports.Kv = Kv
324
326
  module.exports.Queue = Queue
325
327
  module.exports.QueueMessage = QueueMessage
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivetkit/rivetkit-napi",
3
- "version": "2.3.7",
3
+ "version": "2.3.8",
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",
@@ -44,15 +44,15 @@
44
44
  },
45
45
  "dependencies": {
46
46
  "@napi-rs/cli": "^2.18.4",
47
- "@rivetkit/engine-envoy-protocol": "2.3.7"
47
+ "@rivetkit/engine-envoy-protocol": "2.3.8"
48
48
  },
49
49
  "optionalDependencies": {
50
- "@rivetkit/rivetkit-napi-darwin-arm64": "2.3.7",
51
- "@rivetkit/rivetkit-napi-darwin-x64": "2.3.7",
52
- "@rivetkit/rivetkit-napi-linux-arm64-gnu": "2.3.7",
53
- "@rivetkit/rivetkit-napi-linux-arm64-musl": "2.3.7",
54
- "@rivetkit/rivetkit-napi-linux-x64-gnu": "2.3.7",
55
- "@rivetkit/rivetkit-napi-linux-x64-musl": "2.3.7",
56
- "@rivetkit/rivetkit-napi-win32-x64-msvc": "2.3.7"
50
+ "@rivetkit/rivetkit-napi-darwin-arm64": "2.3.8",
51
+ "@rivetkit/rivetkit-napi-darwin-x64": "2.3.8",
52
+ "@rivetkit/rivetkit-napi-linux-arm64-gnu": "2.3.8",
53
+ "@rivetkit/rivetkit-napi-linux-arm64-musl": "2.3.8",
54
+ "@rivetkit/rivetkit-napi-linux-x64-gnu": "2.3.8",
55
+ "@rivetkit/rivetkit-napi-linux-x64-musl": "2.3.8",
56
+ "@rivetkit/rivetkit-napi-win32-x64-msvc": "2.3.8"
57
57
  }
58
58
  }