@rivetkit/rivetkit-napi 0.0.0-stack-docs-deploy-add-container-runner-page-mqospzuu.cc74539 → 0.0.0-stack-feat-cli-support-multiple-compute-pools-uqzuxkqy.9411557
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 +100 -10
- package/index.js +6 -1
- package/package.json +8 -8
package/index.d.ts
CHANGED
|
@@ -23,10 +23,16 @@ export interface StateDeltaPayload {
|
|
|
23
23
|
connHibernation: Array<StateDeltaConnHibernationEntry>
|
|
24
24
|
connHibernationRemoved: Array<string>
|
|
25
25
|
}
|
|
26
|
+
export interface WorkflowKvWritePayload {
|
|
27
|
+
key: Buffer
|
|
28
|
+
value: Buffer
|
|
29
|
+
}
|
|
26
30
|
export interface JsRequestSaveOpts {
|
|
27
31
|
immediate?: boolean
|
|
28
32
|
maxWaitMs?: number
|
|
29
33
|
}
|
|
34
|
+
export declare function decodeInspectorRequest(bytes: Buffer, advertisedVersion: number): Buffer
|
|
35
|
+
export declare function encodeInspectorResponse(bytes: Buffer, targetVersion: number): Buffer
|
|
30
36
|
export interface JsInspectorSnapshot {
|
|
31
37
|
stateRevision: number
|
|
32
38
|
connectionsRevision: number
|
|
@@ -35,10 +41,8 @@ export interface JsInspectorSnapshot {
|
|
|
35
41
|
queueSize: number
|
|
36
42
|
connectedClients: number
|
|
37
43
|
}
|
|
38
|
-
export interface
|
|
39
|
-
|
|
40
|
-
headers?: Record<string, string>
|
|
41
|
-
body?: Buffer
|
|
44
|
+
export interface JsActorRuntimeSocketEndpointInfo {
|
|
45
|
+
path: string
|
|
42
46
|
}
|
|
43
47
|
export interface JsQueueSendResult {
|
|
44
48
|
status: string
|
|
@@ -72,6 +76,7 @@ export interface JsActorConfig {
|
|
|
72
76
|
icon?: string
|
|
73
77
|
hasDatabase?: boolean
|
|
74
78
|
remoteSqlite?: boolean
|
|
79
|
+
enableActorRuntimeSocket?: boolean
|
|
75
80
|
hasState?: boolean
|
|
76
81
|
canHibernateWebsocket?: boolean
|
|
77
82
|
stateSaveIntervalMs?: number
|
|
@@ -92,11 +97,10 @@ export interface JsActorConfig {
|
|
|
92
97
|
connectionLivenessTimeoutMs?: number
|
|
93
98
|
connectionLivenessIntervalMs?: number
|
|
94
99
|
maxQueueSize?: number
|
|
100
|
+
maxSchedules?: number
|
|
95
101
|
maxQueueMessageSize?: number
|
|
96
102
|
maxIncomingMessageSize?: number
|
|
97
103
|
maxOutgoingMessageSize?: number
|
|
98
|
-
preloadMaxWorkflowBytes?: number
|
|
99
|
-
preloadMaxConnectionsBytes?: number
|
|
100
104
|
actions?: Array<JsActionDefinition>
|
|
101
105
|
inspectorTabs?: Array<JsInspectorTabEntry>
|
|
102
106
|
}
|
|
@@ -120,6 +124,10 @@ export interface NativeExecuteResult {
|
|
|
120
124
|
changes: number
|
|
121
125
|
lastInsertRowId?: number
|
|
122
126
|
}
|
|
127
|
+
export interface JsSqliteBatchStatement {
|
|
128
|
+
sql: string
|
|
129
|
+
params?: Array<JsBindParam>
|
|
130
|
+
}
|
|
123
131
|
export interface JsSqliteVfsMetrics {
|
|
124
132
|
requestBuildNs: number
|
|
125
133
|
serializeNs: number
|
|
@@ -133,6 +141,12 @@ export interface JsSqliteVfsMetrics {
|
|
|
133
141
|
writeBufferDirtyPages: number
|
|
134
142
|
dbSizePages: number
|
|
135
143
|
}
|
|
144
|
+
export interface JsHttpResponse {
|
|
145
|
+
status?: number
|
|
146
|
+
headers?: Record<string, string>
|
|
147
|
+
body?: Buffer
|
|
148
|
+
stream?: boolean
|
|
149
|
+
}
|
|
136
150
|
export interface JsQueueNextOptions {
|
|
137
151
|
names?: Array<string>
|
|
138
152
|
timeoutMs?: number
|
|
@@ -207,6 +221,12 @@ export interface JsServerlessResponseHead {
|
|
|
207
221
|
status: number
|
|
208
222
|
headers: Record<string, string>
|
|
209
223
|
}
|
|
224
|
+
export interface JsApplicationResponse {
|
|
225
|
+
status: number
|
|
226
|
+
headers: Record<string, string>
|
|
227
|
+
body?: Buffer
|
|
228
|
+
stream?: boolean
|
|
229
|
+
}
|
|
210
230
|
export interface JsRegistryRouteResponse {
|
|
211
231
|
status: number
|
|
212
232
|
headers: Record<string, string>
|
|
@@ -217,6 +237,38 @@ export interface JsServerlessStreamError {
|
|
|
217
237
|
code: string
|
|
218
238
|
message: string
|
|
219
239
|
}
|
|
240
|
+
export interface JsScheduledEventInfo {
|
|
241
|
+
id: string
|
|
242
|
+
action: string
|
|
243
|
+
args: Buffer
|
|
244
|
+
runAt: number
|
|
245
|
+
}
|
|
246
|
+
export interface JsCronJobInfo {
|
|
247
|
+
name: string
|
|
248
|
+
kind: string
|
|
249
|
+
action: string
|
|
250
|
+
args: Buffer
|
|
251
|
+
nextRunAt: number
|
|
252
|
+
lastRunAt?: number
|
|
253
|
+
expression?: string
|
|
254
|
+
timezone?: string
|
|
255
|
+
intervalMs?: number
|
|
256
|
+
maxHistory: number
|
|
257
|
+
}
|
|
258
|
+
export interface JsScheduleErrorInfo {
|
|
259
|
+
group: string
|
|
260
|
+
code: string
|
|
261
|
+
message: string
|
|
262
|
+
metadata?: any
|
|
263
|
+
}
|
|
264
|
+
export interface JsCronFire {
|
|
265
|
+
action: string
|
|
266
|
+
scheduledAt: number
|
|
267
|
+
firedAt: number
|
|
268
|
+
finishedAt?: number
|
|
269
|
+
result: string
|
|
270
|
+
error?: JsScheduleErrorInfo
|
|
271
|
+
}
|
|
220
272
|
/** Options for KV list operations. */
|
|
221
273
|
export interface JsKvListOptions {
|
|
222
274
|
reverse?: boolean
|
|
@@ -229,12 +281,12 @@ export interface JsKvEntry {
|
|
|
229
281
|
}
|
|
230
282
|
/** N-API wrapper around `rivetkit-core::ActorContext`. */
|
|
231
283
|
export declare class ActorContext {
|
|
232
|
-
constructor(actorId: string, name: string, region: string)
|
|
233
284
|
state(): Buffer
|
|
234
285
|
beginOnStateChange(): void
|
|
235
286
|
endOnStateChange(): void
|
|
236
287
|
kv(): Kv
|
|
237
288
|
sql(): JsNativeDatabase
|
|
289
|
+
provisionActorRuntimeSocket(): Promise<JsActorRuntimeSocketEndpointInfo>
|
|
238
290
|
schedule(): Schedule
|
|
239
291
|
queue(): Queue
|
|
240
292
|
setAlarm(timestampMs?: number | undefined | null): void
|
|
@@ -249,6 +301,7 @@ export declare class ActorContext {
|
|
|
249
301
|
takePendingHibernationChanges(): Array<string>
|
|
250
302
|
dirtyHibernatableConns(): Array<ConnHandle>
|
|
251
303
|
saveState(payload: StateDeltaPayload): Promise<void>
|
|
304
|
+
saveStateAndWorkflowBatch(writes: Array<WorkflowKvWritePayload>): Promise<void>
|
|
252
305
|
actorId(): string
|
|
253
306
|
name(): string
|
|
254
307
|
key(): Array<JsActorKeySegment>
|
|
@@ -304,8 +357,28 @@ export declare class JsNativeDatabase {
|
|
|
304
357
|
run(sql: string, params?: Array<JsBindParam> | undefined | null): Promise<ExecuteResult>
|
|
305
358
|
query(sql: string, params?: Array<JsBindParam> | undefined | null): Promise<QueryResult>
|
|
306
359
|
execute(sql: string, params?: Array<JsBindParam> | undefined | null): Promise<NativeExecuteResult>
|
|
360
|
+
executeBatch(statements: Array<JsSqliteBatchStatement>): Promise<Array<NativeExecuteResult>>
|
|
307
361
|
exec(sql: string): Promise<QueryResult>
|
|
308
362
|
close(): Promise<void>
|
|
363
|
+
beginTransaction(timeoutMs?: number | undefined | null): Promise<JsSqliteTransaction>
|
|
364
|
+
}
|
|
365
|
+
export declare class JsSqliteTransaction {
|
|
366
|
+
execute(sql: string, params?: Array<JsBindParam> | undefined | null): Promise<NativeExecuteResult>
|
|
367
|
+
exec(sql: string): Promise<QueryResult>
|
|
368
|
+
commit(): Promise<void>
|
|
369
|
+
rollback(): Promise<void>
|
|
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>
|
|
309
382
|
}
|
|
310
383
|
export declare class Kv {
|
|
311
384
|
get(key: Buffer): Promise<Buffer | null>
|
|
@@ -343,6 +416,13 @@ export declare class CoreRegistry {
|
|
|
343
416
|
constructor()
|
|
344
417
|
register(name: string, factory: NapiActorFactory): void
|
|
345
418
|
serve(config: JsServeConfig): Promise<void>
|
|
419
|
+
/**
|
|
420
|
+
* Wait until the serverful envoy has completed its Engine registration.
|
|
421
|
+
*
|
|
422
|
+
* Readiness is the envoy client's `ToEnvoyInit` signal, not HTTP health or
|
|
423
|
+
* merely constructing the envoy handle.
|
|
424
|
+
*/
|
|
425
|
+
waitReady(): Promise<void>
|
|
346
426
|
/**
|
|
347
427
|
* Trip the shutdown token and tear down any live serverless runtime.
|
|
348
428
|
*
|
|
@@ -355,12 +435,22 @@ export declare class CoreRegistry {
|
|
|
355
435
|
health(): Promise<JsRegistryRouteResponse>
|
|
356
436
|
metadata(): JsRegistryRouteResponse
|
|
357
437
|
metrics(): JsRegistryRouteResponse
|
|
358
|
-
|
|
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>
|
|
359
440
|
handleServerlessRequest(req: JsServerlessRequest, onStreamEvent: (...args: any[]) => any, cancelToken: CancellationToken, config: JsServeConfig): Promise<JsServerlessResponseHead>
|
|
360
441
|
}
|
|
361
442
|
export declare class Schedule {
|
|
362
|
-
after(durationMs: number, actionName: string, args: Buffer):
|
|
363
|
-
at(timestampMs: number, actionName: string, args: Buffer):
|
|
443
|
+
after(durationMs: number, actionName: string, args: Buffer): Promise<string>
|
|
444
|
+
at(timestampMs: number, actionName: string, args: Buffer): Promise<string>
|
|
445
|
+
cancel(id: string): Promise<boolean>
|
|
446
|
+
get(id: string): Promise<JsScheduledEventInfo | null>
|
|
447
|
+
list(): Promise<Array<JsScheduledEventInfo>>
|
|
448
|
+
cronSet(name: string, expression: string, timezone: string | undefined | null, actionName: string, args: Buffer, maxHistory?: number | undefined | null): Promise<void>
|
|
449
|
+
cronEvery(name: string, intervalMs: number, actionName: string, args: Buffer, maxHistory?: number | undefined | null): Promise<void>
|
|
450
|
+
cronGet(name: string): Promise<JsCronJobInfo | null>
|
|
451
|
+
cronList(): Promise<Array<JsCronJobInfo>>
|
|
452
|
+
cronDelete(name: string): Promise<boolean>
|
|
453
|
+
cronHistory(name: string, limit?: number | undefined | null): Promise<Array<JsCronFire>>
|
|
364
454
|
}
|
|
365
455
|
export declare class WebSocket {
|
|
366
456
|
send(data: Buffer, binary: boolean): void
|
package/index.js
CHANGED
|
@@ -310,13 +310,18 @@ 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, 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
|
+
module.exports.decodeInspectorRequest = decodeInspectorRequest
|
|
317
|
+
module.exports.encodeInspectorResponse = encodeInspectorResponse
|
|
316
318
|
module.exports.NapiActorFactory = NapiActorFactory
|
|
317
319
|
module.exports.CancellationToken = CancellationToken
|
|
318
320
|
module.exports.ConnHandle = ConnHandle
|
|
319
321
|
module.exports.JsNativeDatabase = JsNativeDatabase
|
|
322
|
+
module.exports.JsSqliteTransaction = JsSqliteTransaction
|
|
323
|
+
module.exports.HttpResponseBodyStream = HttpResponseBodyStream
|
|
324
|
+
module.exports.HttpRequestBodyStream = HttpRequestBodyStream
|
|
320
325
|
module.exports.Kv = Kv
|
|
321
326
|
module.exports.Queue = Queue
|
|
322
327
|
module.exports.QueueMessage = QueueMessage
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rivetkit/rivetkit-napi",
|
|
3
|
-
"version": "0.0.0-stack-
|
|
3
|
+
"version": "0.0.0-stack-feat-cli-support-multiple-compute-pools-uqzuxkqy.9411557",
|
|
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,14 +44,14 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"@napi-rs/cli": "^2.18.4",
|
|
47
|
-
"@rivetkit/engine-envoy-protocol": "0.0.0-stack-
|
|
47
|
+
"@rivetkit/engine-envoy-protocol": "0.0.0-stack-feat-cli-support-multiple-compute-pools-uqzuxkqy.9411557"
|
|
48
48
|
},
|
|
49
49
|
"optionalDependencies": {
|
|
50
|
-
"@rivetkit/rivetkit-napi-darwin-arm64": "0.0.0-stack-
|
|
51
|
-
"@rivetkit/rivetkit-napi-darwin-x64": "0.0.0-stack-
|
|
52
|
-
"@rivetkit/rivetkit-napi-linux-arm64-gnu": "0.0.0-stack-
|
|
53
|
-
"@rivetkit/rivetkit-napi-linux-arm64-musl": "0.0.0-stack-
|
|
54
|
-
"@rivetkit/rivetkit-napi-linux-x64-gnu": "0.0.0-stack-
|
|
55
|
-
"@rivetkit/rivetkit-napi-linux-x64-musl": "0.0.0-stack-
|
|
50
|
+
"@rivetkit/rivetkit-napi-darwin-arm64": "0.0.0-stack-feat-cli-support-multiple-compute-pools-uqzuxkqy.9411557",
|
|
51
|
+
"@rivetkit/rivetkit-napi-darwin-x64": "0.0.0-stack-feat-cli-support-multiple-compute-pools-uqzuxkqy.9411557",
|
|
52
|
+
"@rivetkit/rivetkit-napi-linux-arm64-gnu": "0.0.0-stack-feat-cli-support-multiple-compute-pools-uqzuxkqy.9411557",
|
|
53
|
+
"@rivetkit/rivetkit-napi-linux-arm64-musl": "0.0.0-stack-feat-cli-support-multiple-compute-pools-uqzuxkqy.9411557",
|
|
54
|
+
"@rivetkit/rivetkit-napi-linux-x64-gnu": "0.0.0-stack-feat-cli-support-multiple-compute-pools-uqzuxkqy.9411557",
|
|
55
|
+
"@rivetkit/rivetkit-napi-linux-x64-musl": "0.0.0-stack-feat-cli-support-multiple-compute-pools-uqzuxkqy.9411557"
|
|
56
56
|
}
|
|
57
57
|
}
|