@rivetkit/rivetkit-napi 0.0.0-main.9809768 → 0.0.0-main.9d355a2
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 +63 -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
|
|
@@ -152,6 +187,16 @@ export interface JsServeConfig {
|
|
|
152
187
|
serverlessValidateEndpoint: boolean
|
|
153
188
|
serverlessMaxStartPayloadBytes: number
|
|
154
189
|
}
|
|
190
|
+
export interface JsListenerConfig {
|
|
191
|
+
/** Host to bind. Defaults to `0.0.0.0` when not provided. */
|
|
192
|
+
host?: string
|
|
193
|
+
port: number
|
|
194
|
+
/**
|
|
195
|
+
* Optional static file root mounted as a fallback below the framework
|
|
196
|
+
* routes.
|
|
197
|
+
*/
|
|
198
|
+
publicDir?: string
|
|
199
|
+
}
|
|
155
200
|
export interface JsServerlessRequest {
|
|
156
201
|
method: string
|
|
157
202
|
url: string
|
|
@@ -162,6 +207,11 @@ export interface JsServerlessResponseHead {
|
|
|
162
207
|
status: number
|
|
163
208
|
headers: Record<string, string>
|
|
164
209
|
}
|
|
210
|
+
export interface JsRegistryRouteResponse {
|
|
211
|
+
status: number
|
|
212
|
+
headers: Record<string, string>
|
|
213
|
+
body: Buffer
|
|
214
|
+
}
|
|
165
215
|
export interface JsServerlessStreamError {
|
|
166
216
|
group: string
|
|
167
217
|
code: string
|
|
@@ -212,6 +262,9 @@ export declare class ActorContext {
|
|
|
212
262
|
aborted(): boolean
|
|
213
263
|
runHandlerActive(): boolean
|
|
214
264
|
restartRunHandler(): void
|
|
265
|
+
beginKeepAwake(): number
|
|
266
|
+
endKeepAwake(regionId: number): void
|
|
267
|
+
keepAwake(promise: Promise<any>): void
|
|
215
268
|
beginWebsocketCallback(): number
|
|
216
269
|
endWebsocketCallback(regionId: number): void
|
|
217
270
|
abortSignal(): AbortSignal
|
|
@@ -221,7 +274,8 @@ export declare class ActorContext {
|
|
|
221
274
|
disconnectConns(predicate: (...args: any[]) => any): Promise<void>
|
|
222
275
|
broadcast(name: string, args: Buffer): void
|
|
223
276
|
waitUntil(promise: Promise<any>): void
|
|
224
|
-
|
|
277
|
+
waitForTrackedShutdownWork(): Promise<boolean>
|
|
278
|
+
waitForTrackedShutdownWorkUnbounded(): Promise<void>
|
|
225
279
|
registerTask(promise: Promise<any>): void
|
|
226
280
|
runtimeState(): object
|
|
227
281
|
clearRuntimeState(): void
|
|
@@ -246,9 +300,10 @@ export declare class ConnHandle {
|
|
|
246
300
|
}
|
|
247
301
|
export declare class JsNativeDatabase {
|
|
248
302
|
takeLastKvError(): string | null
|
|
249
|
-
|
|
303
|
+
metrics(): JsSqliteVfsMetrics | null
|
|
250
304
|
run(sql: string, params?: Array<JsBindParam> | undefined | null): Promise<ExecuteResult>
|
|
251
305
|
query(sql: string, params?: Array<JsBindParam> | undefined | null): Promise<QueryResult>
|
|
306
|
+
execute(sql: string, params?: Array<JsBindParam> | undefined | null): Promise<NativeExecuteResult>
|
|
252
307
|
exec(sql: string): Promise<QueryResult>
|
|
253
308
|
close(): Promise<void>
|
|
254
309
|
}
|
|
@@ -268,7 +323,7 @@ export declare class Queue {
|
|
|
268
323
|
next(options?: JsQueueNextOptions | undefined | null, signal?: CancellationToken | undefined | null): Promise<QueueMessage | null>
|
|
269
324
|
nextBatch(options?: JsQueueNextBatchOptions | undefined | null, signal?: CancellationToken | undefined | null): Promise<Array<QueueMessage>>
|
|
270
325
|
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>
|
|
326
|
+
waitForNamesAvailable(names: Array<string>, options?: JsQueueWaitOptions | undefined | null, signal?: CancellationToken | undefined | null): Promise<void>
|
|
272
327
|
enqueueAndWait(name: string, body: Buffer, options?: JsQueueEnqueueAndWaitOptions | undefined | null, signal?: CancellationToken | undefined | null): Promise<Buffer | null>
|
|
273
328
|
tryNext(options?: JsQueueTryNextOptions | undefined | null): QueueMessage | null
|
|
274
329
|
tryNextBatch(options?: JsQueueTryNextBatchOptions | undefined | null): Array<QueueMessage>
|
|
@@ -295,6 +350,11 @@ export declare class CoreRegistry {
|
|
|
295
350
|
* separately to avoid re-entrancy.
|
|
296
351
|
*/
|
|
297
352
|
shutdown(): Promise<void>
|
|
353
|
+
actorStopThresholdMs(): Promise<number | null>
|
|
354
|
+
health(): Promise<JsRegistryRouteResponse>
|
|
355
|
+
metadata(): JsRegistryRouteResponse
|
|
356
|
+
metrics(): JsRegistryRouteResponse
|
|
357
|
+
serveListener(listener: JsListenerConfig, config: JsServeConfig): Promise<void>
|
|
298
358
|
handleServerlessRequest(req: JsServerlessRequest, onStreamEvent: (...args: any[]) => any, cancelToken: CancellationToken, config: JsServeConfig): Promise<JsServerlessResponseHead>
|
|
299
359
|
}
|
|
300
360
|
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.9d355a2",
|
|
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.9d355a2"
|
|
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.9809768"
|
|
49
|
+
"@rivetkit/rivetkit-napi-darwin-arm64": "0.0.0-main.9d355a2",
|
|
50
|
+
"@rivetkit/rivetkit-napi-darwin-x64": "0.0.0-main.9d355a2",
|
|
51
|
+
"@rivetkit/rivetkit-napi-linux-arm64-gnu": "0.0.0-main.9d355a2",
|
|
52
|
+
"@rivetkit/rivetkit-napi-linux-arm64-musl": "0.0.0-main.9d355a2",
|
|
53
|
+
"@rivetkit/rivetkit-napi-linux-x64-gnu": "0.0.0-main.9d355a2",
|
|
54
|
+
"@rivetkit/rivetkit-napi-linux-x64-musl": "0.0.0-main.9d355a2"
|
|
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" });
|