@rivetkit/rivetkit-napi 2.3.0-rc.8 → 2.3.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/index.d.ts +32 -14
- package/index.js +1 -10
- package/package.json +9 -9
- package/scripts/build.mjs +8 -0
package/index.d.ts
CHANGED
|
@@ -47,6 +47,26 @@ export interface JsQueueSendResult {
|
|
|
47
47
|
export interface JsActionDefinition {
|
|
48
48
|
name: string
|
|
49
49
|
}
|
|
50
|
+
/**
|
|
51
|
+
* One entry in the actor's `inspector.tabs[]` declaration. Either a
|
|
52
|
+
* custom-tab descriptor (id + label + source dir) or a built-in modifier
|
|
53
|
+
* (id + hidden=true). Validation already happened on the TS side; the
|
|
54
|
+
* runtime just splits the discriminator.
|
|
55
|
+
*/
|
|
56
|
+
export interface JsInspectorTabEntry {
|
|
57
|
+
id: string
|
|
58
|
+
/** Required for custom entries; omitted for HideBuiltin. */
|
|
59
|
+
label?: string
|
|
60
|
+
/** Required for custom entries — absolute path to the source directory. */
|
|
61
|
+
source?: string
|
|
62
|
+
/**
|
|
63
|
+
* Optional icon id for custom entries. Dashboard maps strings to
|
|
64
|
+
* glyphs; unknown ids fall back to a generic icon.
|
|
65
|
+
*/
|
|
66
|
+
icon?: string
|
|
67
|
+
/** Set to true for HideBuiltin entries. */
|
|
68
|
+
hidden?: boolean
|
|
69
|
+
}
|
|
50
70
|
export interface JsActorConfig {
|
|
51
71
|
name?: string
|
|
52
72
|
icon?: string
|
|
@@ -78,6 +98,7 @@ export interface JsActorConfig {
|
|
|
78
98
|
preloadMaxWorkflowBytes?: number
|
|
79
99
|
preloadMaxConnectionsBytes?: number
|
|
80
100
|
actions?: Array<JsActionDefinition>
|
|
101
|
+
inspectorTabs?: Array<JsInspectorTabEntry>
|
|
81
102
|
}
|
|
82
103
|
export interface JsBindParam {
|
|
83
104
|
kind: string
|
|
@@ -155,6 +176,8 @@ export interface JsServeConfig {
|
|
|
155
176
|
namespace: string
|
|
156
177
|
poolName: string
|
|
157
178
|
engineBinaryPath?: string
|
|
179
|
+
engineHost?: string
|
|
180
|
+
enginePort?: number
|
|
158
181
|
handleInspectorHttpInRuntime?: boolean
|
|
159
182
|
serverlessBasePath?: string
|
|
160
183
|
serverlessPackageVersion: string
|
|
@@ -174,24 +197,16 @@ export interface JsServerlessResponseHead {
|
|
|
174
197
|
status: number
|
|
175
198
|
headers: Record<string, string>
|
|
176
199
|
}
|
|
177
|
-
export interface
|
|
178
|
-
|
|
179
|
-
|
|
200
|
+
export interface JsRegistryRouteResponse {
|
|
201
|
+
status: number
|
|
202
|
+
headers: Record<string, string>
|
|
203
|
+
body: Buffer
|
|
180
204
|
}
|
|
181
205
|
export interface JsServerlessStreamError {
|
|
182
206
|
group: string
|
|
183
207
|
code: string
|
|
184
208
|
message: string
|
|
185
209
|
}
|
|
186
|
-
export declare function jsSetEventloopLagQuantile(quantile: string, seconds: number): void
|
|
187
|
-
export declare function jsSetEventloopUtilization(value: number): void
|
|
188
|
-
export declare function jsSetEventloopHeartbeatTsMs(epochMs: number): void
|
|
189
|
-
export declare function jsAddProcessCpuSeconds(mode: string, seconds: number): void
|
|
190
|
-
export declare function jsSetProcessResidentMemoryBytes(bytes: number): void
|
|
191
|
-
export declare function jsSetHeapBytes(state: string, bytes: number): void
|
|
192
|
-
export declare function jsObserveGcDuration(kind: string, seconds: number): void
|
|
193
|
-
export declare function jsSetActiveHandles(count: number): void
|
|
194
|
-
export declare function jsSetActiveRequests(count: number): void
|
|
195
210
|
/** Options for KV list operations. */
|
|
196
211
|
export interface JsKvListOptions {
|
|
197
212
|
reverse?: boolean
|
|
@@ -250,6 +265,7 @@ export declare class ActorContext {
|
|
|
250
265
|
broadcast(name: string, args: Buffer): void
|
|
251
266
|
waitUntil(promise: Promise<any>): void
|
|
252
267
|
waitForTrackedShutdownWork(): Promise<boolean>
|
|
268
|
+
waitForTrackedShutdownWorkUnbounded(): Promise<void>
|
|
253
269
|
registerTask(promise: Promise<any>): void
|
|
254
270
|
runtimeState(): object
|
|
255
271
|
clearRuntimeState(): void
|
|
@@ -297,7 +313,7 @@ export declare class Queue {
|
|
|
297
313
|
next(options?: JsQueueNextOptions | undefined | null, signal?: CancellationToken | undefined | null): Promise<QueueMessage | null>
|
|
298
314
|
nextBatch(options?: JsQueueNextBatchOptions | undefined | null, signal?: CancellationToken | undefined | null): Promise<Array<QueueMessage>>
|
|
299
315
|
waitForNames(names: Array<string>, options?: JsQueueWaitOptions | undefined | null, signal?: CancellationToken | undefined | null): Promise<QueueMessage>
|
|
300
|
-
waitForNamesAvailable(names: Array<string>, options?: JsQueueWaitOptions | undefined | null): Promise<void>
|
|
316
|
+
waitForNamesAvailable(names: Array<string>, options?: JsQueueWaitOptions | undefined | null, signal?: CancellationToken | undefined | null): Promise<void>
|
|
301
317
|
enqueueAndWait(name: string, body: Buffer, options?: JsQueueEnqueueAndWaitOptions | undefined | null, signal?: CancellationToken | undefined | null): Promise<Buffer | null>
|
|
302
318
|
tryNext(options?: JsQueueTryNextOptions | undefined | null): QueueMessage | null
|
|
303
319
|
tryNextBatch(options?: JsQueueTryNextBatchOptions | undefined | null): Array<QueueMessage>
|
|
@@ -325,7 +341,9 @@ export declare class CoreRegistry {
|
|
|
325
341
|
*/
|
|
326
342
|
shutdown(): Promise<void>
|
|
327
343
|
actorStopThresholdMs(): Promise<number | null>
|
|
328
|
-
|
|
344
|
+
health(): Promise<JsRegistryRouteResponse>
|
|
345
|
+
metadata(): JsRegistryRouteResponse
|
|
346
|
+
metrics(): JsRegistryRouteResponse
|
|
329
347
|
handleServerlessRequest(req: JsServerlessRequest, onStreamEvent: (...args: any[]) => any, cancelToken: CancellationToken, config: JsServeConfig): Promise<JsServerlessResponseHead>
|
|
330
348
|
}
|
|
331
349
|
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, NapiActorFactory, CancellationToken, ConnHandle, JsNativeDatabase, Kv, Queue, QueueMessage, CoreRegistry,
|
|
313
|
+
const { ActorContext, NapiActorFactory, CancellationToken, ConnHandle, JsNativeDatabase, Kv, Queue, QueueMessage, CoreRegistry, Schedule, WebSocket } = nativeBinding
|
|
314
314
|
|
|
315
315
|
module.exports.ActorContext = ActorContext
|
|
316
316
|
module.exports.NapiActorFactory = NapiActorFactory
|
|
@@ -321,14 +321,5 @@ module.exports.Kv = Kv
|
|
|
321
321
|
module.exports.Queue = Queue
|
|
322
322
|
module.exports.QueueMessage = QueueMessage
|
|
323
323
|
module.exports.CoreRegistry = CoreRegistry
|
|
324
|
-
module.exports.jsSetEventloopLagQuantile = jsSetEventloopLagQuantile
|
|
325
|
-
module.exports.jsSetEventloopUtilization = jsSetEventloopUtilization
|
|
326
|
-
module.exports.jsSetEventloopHeartbeatTsMs = jsSetEventloopHeartbeatTsMs
|
|
327
|
-
module.exports.jsAddProcessCpuSeconds = jsAddProcessCpuSeconds
|
|
328
|
-
module.exports.jsSetProcessResidentMemoryBytes = jsSetProcessResidentMemoryBytes
|
|
329
|
-
module.exports.jsSetHeapBytes = jsSetHeapBytes
|
|
330
|
-
module.exports.jsObserveGcDuration = jsObserveGcDuration
|
|
331
|
-
module.exports.jsSetActiveHandles = jsSetActiveHandles
|
|
332
|
-
module.exports.jsSetActiveRequests = jsSetActiveRequests
|
|
333
324
|
module.exports.Schedule = Schedule
|
|
334
325
|
module.exports.WebSocket = WebSocket
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rivetkit/rivetkit-napi",
|
|
3
|
-
"version": "2.3.0
|
|
3
|
+
"version": "2.3.0",
|
|
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",
|
|
@@ -43,15 +43,15 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@napi-rs/cli": "^2.18.4",
|
|
46
|
-
"@rivetkit/engine-envoy-protocol": "2.3.0
|
|
46
|
+
"@rivetkit/engine-envoy-protocol": "2.3.0"
|
|
47
47
|
},
|
|
48
48
|
"optionalDependencies": {
|
|
49
|
-
"@rivetkit/rivetkit-napi-darwin-arm64": "2.3.0
|
|
50
|
-
"@rivetkit/rivetkit-napi-darwin-x64": "2.3.0
|
|
51
|
-
"@rivetkit/rivetkit-napi-linux-arm64-gnu": "2.3.0
|
|
52
|
-
"@rivetkit/rivetkit-napi-linux-arm64-musl": "2.3.0
|
|
53
|
-
"@rivetkit/rivetkit-napi-linux-x64-gnu": "2.3.0
|
|
54
|
-
"@rivetkit/rivetkit-napi-linux-x64-musl": "2.3.0
|
|
55
|
-
"@rivetkit/rivetkit-napi-win32-x64-msvc": "2.3.0
|
|
49
|
+
"@rivetkit/rivetkit-napi-darwin-arm64": "2.3.0",
|
|
50
|
+
"@rivetkit/rivetkit-napi-darwin-x64": "2.3.0",
|
|
51
|
+
"@rivetkit/rivetkit-napi-linux-arm64-gnu": "2.3.0",
|
|
52
|
+
"@rivetkit/rivetkit-napi-linux-arm64-musl": "2.3.0",
|
|
53
|
+
"@rivetkit/rivetkit-napi-linux-x64-gnu": "2.3.0",
|
|
54
|
+
"@rivetkit/rivetkit-napi-linux-x64-musl": "2.3.0",
|
|
55
|
+
"@rivetkit/rivetkit-napi-win32-x64-msvc": "2.3.0"
|
|
56
56
|
}
|
|
57
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" });
|