@rivetkit/rivetkit-napi 0.0.0-feat-sqlite-sync.32022a9 → 0.0.0-feat-sqlite-sync-3x.a00b07f

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 +28 -5
  2. package/index.js +2 -1
  3. package/package.json +11 -9
package/index.d.ts CHANGED
@@ -88,7 +88,8 @@ export interface JsInspectorTabEntry {
88
88
  * surface is subject to change without notice.
89
89
  */
90
90
  export interface JsSqliteProfilingConfig {
91
- enabled?: boolean
91
+ queries?: Array<string>
92
+ fingerprints?: Array<string>
92
93
  maxTrackedStatementFingerprints?: number
93
94
  maxTrackedTransactionFingerprints?: number
94
95
  maxPrometheusSeries?: number
@@ -231,6 +232,7 @@ export interface JsServeConfig {
231
232
  engineBinaryPath?: string
232
233
  startServices?: boolean
233
234
  servicesBinaryPath?: string
235
+ engineSpawn?: boolean
234
236
  engineHost?: string
235
237
  enginePort?: number
236
238
  handleInspectorHttpInRuntime?: boolean
@@ -442,7 +444,28 @@ export declare class CancellationToken {
442
444
  constructor()
443
445
  aborted(): boolean
444
446
  cancel(): void
445
- onCancelled(callback: (...args: any[]) => any): void
447
+ /**
448
+ * Calls `callback` once when the token is cancelled.
449
+ *
450
+ * The returned listener must be released when the caller stops caring
451
+ * about cancellation. Releasing ends the waiting task and frees the
452
+ * threadsafe function, which otherwise stays alive (with its libuv handle
453
+ * and JS closure) until the token is cancelled.
454
+ */
455
+ onCancelled(callback: (...args: any[]) => any): CancellationListener
456
+ }
457
+ /**
458
+ * Registration returned by `CancellationToken.onCancelled`.
459
+ *
460
+ * Dropping the JS object does not release the listener, because the callback
461
+ * must still fire if the caller keeps no reference to the registration.
462
+ */
463
+ export declare class CancellationListener {
464
+ /**
465
+ * Stops waiting for cancellation without calling the callback.
466
+ * Idempotent, and a no-op after the callback has fired.
467
+ */
468
+ release(): void
446
469
  }
447
470
  export declare class ConnHandle {
448
471
  id(): string
@@ -462,19 +485,19 @@ export declare class JsNativeDatabase {
462
485
  executeBatch(statements: Array<JsSqliteBatchStatement>): Promise<Array<NativeExecuteResult>>
463
486
  exec(sql: string): Promise<QueryResult>
464
487
  close(): Promise<void>
488
+ beginTransaction(timeoutMs?: number | undefined | null, name?: string | undefined | null): Promise<JsSqliteTransaction>
465
489
  /** Opens the database so later synchronous calls never fetch its first pages. */
466
490
  open(): Promise<void>
467
491
  executeSync(sql: string, params?: Array<JsBindParam> | undefined | null): NativeExecuteResult
468
492
  execSync(sql: string): QueryResult
469
493
  beginTransactionSync(timeoutMs?: number | undefined | null, name?: string | undefined | null): JsSqliteTransaction
470
494
  /**
471
- * Returns the latest local commit as a ticket. Tickets stay below 2^53 for any
472
- * realistic generation, so they cross to JavaScript as numbers.
495
+ * Returns the latest local commit as a ticket. Tickets stay below 2^53 for any realistic
496
+ * generation, so they cross to JavaScript as numbers.
473
497
  */
474
498
  commitTicket(): number
475
499
  abortGeneration(reason: string): void
476
500
  whenDurable(ticket: number): Promise<void>
477
- beginTransaction(timeoutMs?: number | undefined | null, name?: string | undefined | null): Promise<JsSqliteTransaction>
478
501
  }
479
502
  export declare class JsSqliteTransaction {
480
503
  execute(sql: string, params?: Array<JsBindParam> | undefined | null): Promise<NativeExecuteResult>
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, OutboundCall, WorkflowSpan, WorkflowStepSpan, NapiActorFactory, CancellationToken, ConnHandle, JsNativeDatabase, JsSqliteTransaction, JsActorStateTransaction, HttpResponseBodyStream, HttpRequestBodyStream, Kv, Queue, QueueMessage, CoreRegistry, Schedule, WebSocket, setTelemetryLogSink, shutdownTelemetry } = nativeBinding
313
+ const { ActorContext, decodeInspectorRequest, encodeInspectorResponse, OutboundCall, WorkflowSpan, WorkflowStepSpan, NapiActorFactory, CancellationToken, CancellationListener, ConnHandle, JsNativeDatabase, JsSqliteTransaction, JsActorStateTransaction, HttpResponseBodyStream, HttpRequestBodyStream, Kv, Queue, QueueMessage, CoreRegistry, Schedule, WebSocket, setTelemetryLogSink, shutdownTelemetry } = nativeBinding
314
314
 
315
315
  module.exports.ActorContext = ActorContext
316
316
  module.exports.decodeInspectorRequest = decodeInspectorRequest
@@ -320,6 +320,7 @@ module.exports.WorkflowSpan = WorkflowSpan
320
320
  module.exports.WorkflowStepSpan = WorkflowStepSpan
321
321
  module.exports.NapiActorFactory = NapiActorFactory
322
322
  module.exports.CancellationToken = CancellationToken
323
+ module.exports.CancellationListener = CancellationListener
323
324
  module.exports.ConnHandle = ConnHandle
324
325
  module.exports.JsNativeDatabase = JsNativeDatabase
325
326
  module.exports.JsSqliteTransaction = JsSqliteTransaction
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivetkit/rivetkit-napi",
3
- "version": "0.0.0-feat-sqlite-sync.32022a9",
3
+ "version": "0.0.0-feat-sqlite-sync-3x.a00b07f",
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,8 +43,10 @@
43
43
  "build:embed": "node scripts/build.mjs"
44
44
  },
45
45
  "dependencies": {
46
- "@napi-rs/cli": "^2.18.4",
47
- "@rivetkit/engine-envoy-protocol": "0.0.0-feat-sqlite-sync.32022a9"
46
+ "@rivetkit/engine-envoy-protocol": "0.0.0-feat-sqlite-sync-3x.a00b07f"
47
+ },
48
+ "devDependencies": {
49
+ "@napi-rs/cli": "^2.18.4"
48
50
  },
49
51
  "repository": {
50
52
  "type": "git",
@@ -52,11 +54,11 @@
52
54
  "directory": "rivetkit-typescript/packages/rivetkit-napi"
53
55
  },
54
56
  "optionalDependencies": {
55
- "@rivetkit/rivetkit-napi-darwin-arm64": "0.0.0-feat-sqlite-sync.32022a9",
56
- "@rivetkit/rivetkit-napi-darwin-x64": "0.0.0-feat-sqlite-sync.32022a9",
57
- "@rivetkit/rivetkit-napi-linux-arm64-gnu": "0.0.0-feat-sqlite-sync.32022a9",
58
- "@rivetkit/rivetkit-napi-linux-arm64-musl": "0.0.0-feat-sqlite-sync.32022a9",
59
- "@rivetkit/rivetkit-napi-linux-x64-gnu": "0.0.0-feat-sqlite-sync.32022a9",
60
- "@rivetkit/rivetkit-napi-linux-x64-musl": "0.0.0-feat-sqlite-sync.32022a9"
57
+ "@rivetkit/rivetkit-napi-darwin-arm64": "0.0.0-feat-sqlite-sync-3x.a00b07f",
58
+ "@rivetkit/rivetkit-napi-darwin-x64": "0.0.0-feat-sqlite-sync-3x.a00b07f",
59
+ "@rivetkit/rivetkit-napi-linux-arm64-gnu": "0.0.0-feat-sqlite-sync-3x.a00b07f",
60
+ "@rivetkit/rivetkit-napi-linux-arm64-musl": "0.0.0-feat-sqlite-sync-3x.a00b07f",
61
+ "@rivetkit/rivetkit-napi-linux-x64-gnu": "0.0.0-feat-sqlite-sync-3x.a00b07f",
62
+ "@rivetkit/rivetkit-napi-linux-x64-musl": "0.0.0-feat-sqlite-sync-3x.a00b07f"
61
63
  }
62
64
  }