@rivetkit/rivetkit-napi 0.0.0-sqlite-query-metrics-v2.f5d3605 → 0.0.0-sqlite-sync-3-0-1-release.95f6e2d

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 +43 -26
  2. package/index.js +2 -1
  3. package/package.json +8 -8
package/index.d.ts CHANGED
@@ -83,36 +83,13 @@ export interface JsInspectorTabEntry {
83
83
  /** Set to true for HideBuiltin entries. */
84
84
  hidden?: boolean
85
85
  }
86
- export interface JsSqliteProfilingMetrics {
87
- duration?: boolean
88
- durationHistogram?: boolean
89
- outcomes?: boolean
90
- phaseDurationHistogram?: boolean
91
- getPagesRoundTripsHistogram?: boolean
92
- transactionStatementCountHistogram?: boolean
93
- pagesFetched?: boolean
94
- localPages?: boolean
95
- localBytes?: boolean
96
- getPagesDurationHistogram?: boolean
97
- getPagesPagesHistogram?: boolean
98
- getPagesResponseBytesHistogram?: boolean
99
- getPagesMissingPages?: boolean
100
- workerQueueDepth?: boolean
101
- workerInflight?: boolean
102
- coordinatorQueueDepth?: boolean
103
- fingerprintOverflow?: boolean
104
- eventDropped?: boolean
105
- }
106
86
  /**
107
87
  * Experimental SQLite profiling configuration. This entire configuration
108
88
  * surface is subject to change without notice.
109
89
  */
110
90
  export interface JsSqliteProfilingConfig {
111
- enabled?: boolean
112
- metrics?: JsSqliteProfilingMetrics
113
- durationHistogramBucketsSeconds?: Array<number>
114
- filterQueries?: Array<string>
115
- filterQueryFingerprints?: Array<string>
91
+ queries?: Array<string>
92
+ fingerprints?: Array<string>
116
93
  maxTrackedStatementFingerprints?: number
117
94
  maxTrackedTransactionFingerprints?: number
118
95
  maxPrometheusSeries?: number
@@ -135,6 +112,8 @@ export interface JsActorConfig {
135
112
  icon?: string
136
113
  hasDatabase?: boolean
137
114
  remoteSqlite?: boolean
115
+ /** Internal. Set by rivetkit when the actor's database provider opts into deferred commits. */
116
+ sqliteDeferredCommits?: boolean
138
117
  sqliteProfiling?: JsSqliteProfilingConfig
139
118
  tracing?: JsActorTracingConfig
140
119
  enableActorRuntimeSocket?: boolean
@@ -253,6 +232,7 @@ export interface JsServeConfig {
253
232
  engineBinaryPath?: string
254
233
  startServices?: boolean
255
234
  servicesBinaryPath?: string
235
+ engineSpawn?: boolean
256
236
  engineHost?: string
257
237
  enginePort?: number
258
238
  handleInspectorHttpInRuntime?: boolean
@@ -464,7 +444,28 @@ export declare class CancellationToken {
464
444
  constructor()
465
445
  aborted(): boolean
466
446
  cancel(): void
467
- 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
468
469
  }
469
470
  export declare class ConnHandle {
470
471
  id(): string
@@ -485,12 +486,28 @@ export declare class JsNativeDatabase {
485
486
  exec(sql: string): Promise<QueryResult>
486
487
  close(): Promise<void>
487
488
  beginTransaction(timeoutMs?: number | undefined | null, name?: string | undefined | null): Promise<JsSqliteTransaction>
489
+ /** Opens the database so later synchronous calls never fetch its first pages. */
490
+ open(): Promise<void>
491
+ executeSync(sql: string, params?: Array<JsBindParam> | undefined | null): NativeExecuteResult
492
+ execSync(sql: string): QueryResult
493
+ beginTransactionSync(timeoutMs?: number | undefined | null, name?: string | undefined | null): JsSqliteTransaction
494
+ /**
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.
497
+ */
498
+ commitTicket(): number
499
+ abortGeneration(reason: string): void
500
+ whenDurable(ticket: number): Promise<void>
488
501
  }
489
502
  export declare class JsSqliteTransaction {
490
503
  execute(sql: string, params?: Array<JsBindParam> | undefined | null): Promise<NativeExecuteResult>
491
504
  exec(sql: string): Promise<QueryResult>
492
505
  commit(): Promise<void>
493
506
  rollback(): Promise<void>
507
+ executeSync(sql: string, params?: Array<JsBindParam> | undefined | null): NativeExecuteResult
508
+ execSync(sql: string): QueryResult
509
+ commitSync(): void
510
+ rollbackSync(): void
494
511
  }
495
512
  export declare class JsActorStateTransaction {
496
513
  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-sqlite-query-metrics-v2.f5d3605",
3
+ "version": "0.0.0-sqlite-sync-3-0-1-release.95f6e2d",
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,7 +43,7 @@
43
43
  "build:embed": "node scripts/build.mjs"
44
44
  },
45
45
  "dependencies": {
46
- "@rivetkit/engine-envoy-protocol": "0.0.0-sqlite-query-metrics-v2.f5d3605"
46
+ "@rivetkit/engine-envoy-protocol": "0.0.0-sqlite-sync-3-0-1-release.95f6e2d"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@napi-rs/cli": "^2.18.4"
@@ -54,11 +54,11 @@
54
54
  "directory": "rivetkit-typescript/packages/rivetkit-napi"
55
55
  },
56
56
  "optionalDependencies": {
57
- "@rivetkit/rivetkit-napi-darwin-arm64": "0.0.0-sqlite-query-metrics-v2.f5d3605",
58
- "@rivetkit/rivetkit-napi-darwin-x64": "0.0.0-sqlite-query-metrics-v2.f5d3605",
59
- "@rivetkit/rivetkit-napi-linux-arm64-gnu": "0.0.0-sqlite-query-metrics-v2.f5d3605",
60
- "@rivetkit/rivetkit-napi-linux-arm64-musl": "0.0.0-sqlite-query-metrics-v2.f5d3605",
61
- "@rivetkit/rivetkit-napi-linux-x64-gnu": "0.0.0-sqlite-query-metrics-v2.f5d3605",
62
- "@rivetkit/rivetkit-napi-linux-x64-musl": "0.0.0-sqlite-query-metrics-v2.f5d3605"
57
+ "@rivetkit/rivetkit-napi-darwin-arm64": "0.0.0-sqlite-sync-3-0-1-release.95f6e2d",
58
+ "@rivetkit/rivetkit-napi-darwin-x64": "0.0.0-sqlite-sync-3-0-1-release.95f6e2d",
59
+ "@rivetkit/rivetkit-napi-linux-arm64-gnu": "0.0.0-sqlite-sync-3-0-1-release.95f6e2d",
60
+ "@rivetkit/rivetkit-napi-linux-arm64-musl": "0.0.0-sqlite-sync-3-0-1-release.95f6e2d",
61
+ "@rivetkit/rivetkit-napi-linux-x64-gnu": "0.0.0-sqlite-sync-3-0-1-release.95f6e2d",
62
+ "@rivetkit/rivetkit-napi-linux-x64-musl": "0.0.0-sqlite-sync-3-0-1-release.95f6e2d"
63
63
  }
64
64
  }