@rivetkit/rivetkit-napi 0.0.0-main.41efcce → 0.0.0-main.879b6a2
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 +52 -3
- package/package.json +8 -9
- package/scripts/build.mjs +8 -0
package/index.d.ts
CHANGED
|
@@ -47,10 +47,31 @@ 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
|
|
53
73
|
hasDatabase?: boolean
|
|
74
|
+
remoteSqlite?: boolean
|
|
54
75
|
hasState?: boolean
|
|
55
76
|
canHibernateWebsocket?: boolean
|
|
56
77
|
stateSaveIntervalMs?: number
|
|
@@ -77,6 +98,7 @@ export interface JsActorConfig {
|
|
|
77
98
|
preloadMaxWorkflowBytes?: number
|
|
78
99
|
preloadMaxConnectionsBytes?: number
|
|
79
100
|
actions?: Array<JsActionDefinition>
|
|
101
|
+
inspectorTabs?: Array<JsInspectorTabEntry>
|
|
80
102
|
}
|
|
81
103
|
export interface JsBindParam {
|
|
82
104
|
kind: string
|
|
@@ -92,6 +114,12 @@ export interface QueryResult {
|
|
|
92
114
|
columns: Array<string>
|
|
93
115
|
rows: Array<Array<any>>
|
|
94
116
|
}
|
|
117
|
+
export interface NativeExecuteResult {
|
|
118
|
+
columns: Array<string>
|
|
119
|
+
rows: Array<Array<any>>
|
|
120
|
+
changes: number
|
|
121
|
+
lastInsertRowId?: number
|
|
122
|
+
}
|
|
95
123
|
export interface JsSqliteVfsMetrics {
|
|
96
124
|
requestBuildNs: number
|
|
97
125
|
serializeNs: number
|
|
@@ -99,6 +127,11 @@ export interface JsSqliteVfsMetrics {
|
|
|
99
127
|
stateUpdateNs: number
|
|
100
128
|
totalNs: number
|
|
101
129
|
commitCount: number
|
|
130
|
+
pageCacheEntries: number
|
|
131
|
+
pageCacheWeightedSize: number
|
|
132
|
+
pageCacheCapacityPages: number
|
|
133
|
+
writeBufferDirtyPages: number
|
|
134
|
+
dbSizePages: number
|
|
102
135
|
}
|
|
103
136
|
export interface JsQueueNextOptions {
|
|
104
137
|
names?: Array<string>
|
|
@@ -143,6 +176,8 @@ export interface JsServeConfig {
|
|
|
143
176
|
namespace: string
|
|
144
177
|
poolName: string
|
|
145
178
|
engineBinaryPath?: string
|
|
179
|
+
engineHost?: string
|
|
180
|
+
enginePort?: number
|
|
146
181
|
handleInspectorHttpInRuntime?: boolean
|
|
147
182
|
serverlessBasePath?: string
|
|
148
183
|
serverlessPackageVersion: string
|
|
@@ -162,6 +197,11 @@ export interface JsServerlessResponseHead {
|
|
|
162
197
|
status: number
|
|
163
198
|
headers: Record<string, string>
|
|
164
199
|
}
|
|
200
|
+
export interface JsRegistryRouteResponse {
|
|
201
|
+
status: number
|
|
202
|
+
headers: Record<string, string>
|
|
203
|
+
body: Buffer
|
|
204
|
+
}
|
|
165
205
|
export interface JsServerlessStreamError {
|
|
166
206
|
group: string
|
|
167
207
|
code: string
|
|
@@ -212,6 +252,9 @@ export declare class ActorContext {
|
|
|
212
252
|
aborted(): boolean
|
|
213
253
|
runHandlerActive(): boolean
|
|
214
254
|
restartRunHandler(): void
|
|
255
|
+
beginKeepAwake(): number
|
|
256
|
+
endKeepAwake(regionId: number): void
|
|
257
|
+
keepAwake(promise: Promise<any>): void
|
|
215
258
|
beginWebsocketCallback(): number
|
|
216
259
|
endWebsocketCallback(regionId: number): void
|
|
217
260
|
abortSignal(): AbortSignal
|
|
@@ -221,7 +264,8 @@ export declare class ActorContext {
|
|
|
221
264
|
disconnectConns(predicate: (...args: any[]) => any): Promise<void>
|
|
222
265
|
broadcast(name: string, args: Buffer): void
|
|
223
266
|
waitUntil(promise: Promise<any>): void
|
|
224
|
-
|
|
267
|
+
waitForTrackedShutdownWork(): Promise<boolean>
|
|
268
|
+
waitForTrackedShutdownWorkUnbounded(): Promise<void>
|
|
225
269
|
registerTask(promise: Promise<any>): void
|
|
226
270
|
runtimeState(): object
|
|
227
271
|
clearRuntimeState(): void
|
|
@@ -246,9 +290,10 @@ export declare class ConnHandle {
|
|
|
246
290
|
}
|
|
247
291
|
export declare class JsNativeDatabase {
|
|
248
292
|
takeLastKvError(): string | null
|
|
249
|
-
|
|
293
|
+
metrics(): JsSqliteVfsMetrics | null
|
|
250
294
|
run(sql: string, params?: Array<JsBindParam> | undefined | null): Promise<ExecuteResult>
|
|
251
295
|
query(sql: string, params?: Array<JsBindParam> | undefined | null): Promise<QueryResult>
|
|
296
|
+
execute(sql: string, params?: Array<JsBindParam> | undefined | null): Promise<NativeExecuteResult>
|
|
252
297
|
exec(sql: string): Promise<QueryResult>
|
|
253
298
|
close(): Promise<void>
|
|
254
299
|
}
|
|
@@ -268,7 +313,7 @@ export declare class Queue {
|
|
|
268
313
|
next(options?: JsQueueNextOptions | undefined | null, signal?: CancellationToken | undefined | null): Promise<QueueMessage | null>
|
|
269
314
|
nextBatch(options?: JsQueueNextBatchOptions | undefined | null, signal?: CancellationToken | undefined | null): Promise<Array<QueueMessage>>
|
|
270
315
|
waitForNames(names: Array<string>, options?: JsQueueWaitOptions | undefined | null, signal?: CancellationToken | undefined | null): Promise<QueueMessage>
|
|
271
|
-
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>
|
|
272
317
|
enqueueAndWait(name: string, body: Buffer, options?: JsQueueEnqueueAndWaitOptions | undefined | null, signal?: CancellationToken | undefined | null): Promise<Buffer | null>
|
|
273
318
|
tryNext(options?: JsQueueTryNextOptions | undefined | null): QueueMessage | null
|
|
274
319
|
tryNextBatch(options?: JsQueueTryNextBatchOptions | undefined | null): Array<QueueMessage>
|
|
@@ -295,6 +340,10 @@ export declare class CoreRegistry {
|
|
|
295
340
|
* separately to avoid re-entrancy.
|
|
296
341
|
*/
|
|
297
342
|
shutdown(): Promise<void>
|
|
343
|
+
actorStopThresholdMs(): Promise<number | null>
|
|
344
|
+
health(): Promise<JsRegistryRouteResponse>
|
|
345
|
+
metadata(): JsRegistryRouteResponse
|
|
346
|
+
metrics(): JsRegistryRouteResponse
|
|
298
347
|
handleServerlessRequest(req: JsServerlessRequest, onStreamEvent: (...args: any[]) => any, cancelToken: CancellationToken, config: JsServeConfig): Promise<JsServerlessResponseHead>
|
|
299
348
|
}
|
|
300
349
|
export declare class Schedule {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rivetkit/rivetkit-napi",
|
|
3
|
-
"version": "0.0.0-main.
|
|
3
|
+
"version": "0.0.0-main.879b6a2",
|
|
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,14 @@
|
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@napi-rs/cli": "^2.18.4",
|
|
46
|
-
"@rivetkit/engine-envoy-protocol": "0.0.0-main.
|
|
46
|
+
"@rivetkit/engine-envoy-protocol": "0.0.0-main.879b6a2"
|
|
47
47
|
},
|
|
48
48
|
"optionalDependencies": {
|
|
49
|
-
"@rivetkit/rivetkit-napi-darwin-arm64": "0.0.0-main.
|
|
50
|
-
"@rivetkit/rivetkit-napi-darwin-x64": "0.0.0-main.
|
|
51
|
-
"@rivetkit/rivetkit-napi-linux-arm64-gnu": "0.0.0-main.
|
|
52
|
-
"@rivetkit/rivetkit-napi-linux-arm64-musl": "0.0.0-main.
|
|
53
|
-
"@rivetkit/rivetkit-napi-linux-x64-gnu": "0.0.0-main.
|
|
54
|
-
"@rivetkit/rivetkit-napi-linux-x64-musl": "0.0.0-main.
|
|
55
|
-
"@rivetkit/rivetkit-napi-win32-x64-msvc": "0.0.0-main.41efcce"
|
|
49
|
+
"@rivetkit/rivetkit-napi-darwin-arm64": "0.0.0-main.879b6a2",
|
|
50
|
+
"@rivetkit/rivetkit-napi-darwin-x64": "0.0.0-main.879b6a2",
|
|
51
|
+
"@rivetkit/rivetkit-napi-linux-arm64-gnu": "0.0.0-main.879b6a2",
|
|
52
|
+
"@rivetkit/rivetkit-napi-linux-arm64-musl": "0.0.0-main.879b6a2",
|
|
53
|
+
"@rivetkit/rivetkit-napi-linux-x64-gnu": "0.0.0-main.879b6a2",
|
|
54
|
+
"@rivetkit/rivetkit-napi-linux-x64-musl": "0.0.0-main.879b6a2"
|
|
56
55
|
}
|
|
57
56
|
}
|
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" });
|