@visorcraft/mongreldb 0.20.1 → 0.21.0

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/README.md CHANGED
@@ -29,6 +29,13 @@ class Database {
29
29
  createTable(name: string, schema: SchemaSpec): bigint
30
30
  table(name: string): TableHandle
31
31
  begin(): Transaction
32
+ createProcedure(spec: ProcedureSpec): bigint
33
+ createOrReplaceProcedure(spec: ProcedureSpec): bigint
34
+ dropProcedure(name: string): void
35
+ procedures(): ProcedureInfo[]
36
+ procedure(name: string): ProcedureInfo | null
37
+ callProcedure(name: string, opts?: ProcedureCallOptions): ProcedureCallResult
38
+ callProcedureAsync(name: string, opts?: ProcedureCallOptions): Promise<ProcedureCallResult>
32
39
  sql(sql: string): Promise<Buffer>
33
40
  close(): void
34
41
  }
Binary file
package/native.d.ts CHANGED
@@ -64,6 +64,20 @@ export interface SchemaSpec {
64
64
  columns: Array<ColumnSpec>
65
65
  indexes: Array<IndexSpec>
66
66
  }
67
+ export interface ProcedureSpec {
68
+ json: string
69
+ }
70
+ export interface ProcedureInfo {
71
+ json: string
72
+ }
73
+ export interface ProcedureCallOptions {
74
+ argsJson?: string
75
+ idempotencyKey?: string
76
+ }
77
+ export interface ProcedureCallResult {
78
+ epoch?: bigint
79
+ resultJson: string
80
+ }
67
81
  /**
68
82
  * A single cell value. Only the field matching the column type is read; the
69
83
  * rest are ignored. `bytes` is raw; `text` is UTF-8 (use for `Bytes` columns
@@ -198,6 +212,13 @@ export declare class Database {
198
212
  snapshotEpoch(): bigint
199
213
  /** List all live table names. */
200
214
  tableNames(): Array<string>
215
+ createProcedure(spec: ProcedureSpec): bigint
216
+ createOrReplaceProcedure(spec: ProcedureSpec): bigint
217
+ dropProcedure(name: string): void
218
+ procedures(): Array<ProcedureInfo>
219
+ procedure(name: string): ProcedureInfo | null
220
+ callProcedure(name: string, opts?: ProcedureCallOptions | undefined | null): ProcedureCallResult
221
+ callProcedureAsync(name: string, opts?: ProcedureCallOptions | undefined | null): Promise<ProcedureCallResult>
201
222
  /**
202
223
  * Return the column names of a table as it exists in the **database**
203
224
  * (not the code-defined schema). Lets migrations check whether a column
@@ -440,4 +461,7 @@ export declare class RemoteDatabase {
440
461
  count(table: string): number
441
462
  sql(sql: string): Buffer
442
463
  commit(table: string): bigint
464
+ createProcedure(spec: ProcedureSpec): string
465
+ dropProcedure(name: string): void
466
+ callProcedure(name: string, opts?: ProcedureCallOptions | undefined | null): string
443
467
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visorcraft/mongreldb",
3
- "version": "0.20.1",
3
+ "version": "0.21.0",
4
4
  "description": "High-performance Node.js bindings for MongrelDB with native in-process storage, sub-ms writes, and hybrid indexing.",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",