@query-farm/vgi 0.48.3 → 0.48.5
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 +51 -0
- package/dist/attach-secret-keyfile.d.ts +11 -0
- package/dist/attach-secret-options.d.ts +96 -0
- package/dist/catalog/attach-option.d.ts +6 -0
- package/dist/catalog/descriptors.d.ts +30 -0
- package/dist/catalog/interface.d.ts +43 -0
- package/dist/catalog/read-only.d.ts +16 -2
- package/dist/client-entry.js +1 -1
- package/dist/client-entry.js.map +4 -4
- package/dist/index.core.d.ts +4 -0
- package/dist/index.js +5854 -5234
- package/dist/index.js.map +28 -25
- package/dist/protocol/dispatch.d.ts +11 -0
- package/dist/protocol/handlers/catalog/admin.d.ts +1 -1
- package/dist/protocol/handlers/catalog/index.d.ts +1 -1
- package/dist/protocol/handlers/catalog/index_methods.d.ts +1 -1
- package/dist/protocol/handlers/catalog/macro.d.ts +1 -1
- package/dist/protocol/handlers/catalog/shared.d.ts +36 -3
- package/dist/protocol/handlers/catalog/table.d.ts +1 -1
- package/dist/protocol/handlers/catalog/view.d.ts +1 -1
- package/dist/protocol/handlers/function.d.ts +2 -0
- package/dist/protocol/handlers/table-buffering.d.ts +1 -1
- package/dist/serve-entry.d.ts +5 -0
- package/dist/serve-entry.js +514 -99
- package/dist/serve-entry.js.map +18 -16
- package/dist/worker-cf-entry.js +629 -108
- package/dist/worker-cf-entry.js.map +21 -18
- package/dist/worker.d.ts +10 -0
- package/dist/write-results.d.ts +57 -0
- package/package.json +1 -1
- package/src/attach-secret-keyfile.ts +185 -0
- package/src/attach-secret-options.ts +418 -0
- package/src/catalog/attach-option.ts +6 -0
- package/src/catalog/descriptors.ts +30 -0
- package/src/catalog/interface.ts +70 -0
- package/src/catalog/read-only.ts +123 -18
- package/src/index.core.ts +33 -0
- package/src/protocol/dispatch.ts +14 -2
- package/src/protocol/handlers/catalog/admin.ts +33 -18
- package/src/protocol/handlers/catalog/index.ts +6 -5
- package/src/protocol/handlers/catalog/index_methods.ts +5 -3
- package/src/protocol/handlers/catalog/macro.ts +7 -5
- package/src/protocol/handlers/catalog/shared.ts +69 -6
- package/src/protocol/handlers/catalog/table.ts +58 -19
- package/src/protocol/handlers/catalog/view.ts +9 -7
- package/src/protocol/handlers/function.ts +53 -19
- package/src/protocol/handlers/table-buffering.ts +2 -1
- package/src/serve-entry.ts +6 -1
- package/src/worker.ts +12 -0
- package/src/write-results.ts +174 -0
package/README.md
CHANGED
|
@@ -709,6 +709,57 @@ $ VGI_RPC_GRANT_KEYS="$(openssl rand -base64 32)" bun run scripts/serve.ts
|
|
|
709
709
|
- Sealed grants are not individually revocable: keep the lifetime short; removing a
|
|
710
710
|
key revokes every grant it minted.
|
|
711
711
|
|
|
712
|
+
### ATTACH options in functions and transaction hooks (secret ones included)
|
|
713
|
+
|
|
714
|
+
A catalog declares its ATTACH options (`attachOptions` on the descriptor, or
|
|
715
|
+
`attachOptionSpecs()`); a credential is declared `secret: true`. Every function call
|
|
716
|
+
and transaction hook of an attach reads the options with **`attachOptions()`**, secret
|
|
717
|
+
values included. The framework carries them for you, so you never pack options (and
|
|
718
|
+
never a credential) into your own `attach_opaque_data`:
|
|
719
|
+
|
|
720
|
+
```ts
|
|
721
|
+
import { attachOptions, ReadOnlyCatalogInterface, type CatalogAttachResult } from "@query-farm/vgi";
|
|
722
|
+
|
|
723
|
+
// In any function (bind, or init/process via params.initCall.bind_call):
|
|
724
|
+
const { api_key, region } = attachOptions(params.bindCall.attach_opaque_data);
|
|
725
|
+
|
|
726
|
+
// In a catalog method or transaction hook:
|
|
727
|
+
class MyCatalog extends ReadOnlyCatalogInterface {
|
|
728
|
+
override async attach(name: string, options?: Record<string, unknown>): Promise<CatalogAttachResult> {
|
|
729
|
+
const result = await super.attach(name, options);
|
|
730
|
+
return { ...result, supports_transactions: options?.transactional === true }; // no options in the bytes
|
|
731
|
+
}
|
|
732
|
+
override async transactionCommit(attach: Uint8Array, tx: Uint8Array) {
|
|
733
|
+
const { api_key } = this.attachOptions(attach);
|
|
734
|
+
// ...
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
```
|
|
738
|
+
|
|
739
|
+
How it works: `catalog_attach` appends the options to the catalog's attach bytes and
|
|
740
|
+
encrypts the secret ones (XChaCha20-Poly1305, a fresh random nonce each time) under
|
|
741
|
+
`HKDF-SHA256(root, info "vgi.attach_secret_options.v1")`, with the attach's
|
|
742
|
+
framework UUID as associated data — a blob copied into another attach value does not
|
|
743
|
+
open (`attach_opaque_data not recognized`). The framework strips all of it before
|
|
744
|
+
your code sees the attach bytes. A secret value is never in plaintext in any opaque
|
|
745
|
+
value, on any transport (the sealing spec's rule 5).
|
|
746
|
+
|
|
747
|
+
The root key is, in order:
|
|
748
|
+
|
|
749
|
+
1. `attachSecretKey` (`Worker`, `serveVgiWorker`, or `protocol` on `createVgiFetch`),
|
|
750
|
+
2. the HTTP signing key (`VGI_SIGNING_KEY`, or the one the worker minted at startup),
|
|
751
|
+
3. on stdio / AF_UNIX / launcher pools, the **host-local key file**, shared by every
|
|
752
|
+
VGI worker of the user on the host whatever its SDK:
|
|
753
|
+
`$VGI_ATTACH_SECRET_KEY_FILE`, else `$XDG_RUNTIME_DIR/vgi/attach-secret-options.key`,
|
|
754
|
+
else `<tmpdir>/vgi-<user>/attach-secret-options.key` — 32 random bytes, created
|
|
755
|
+
atomically on first use with mode 0600 in a 0700 directory, refused if anyone else
|
|
756
|
+
can read it. It is read only when a secret option actually has a value.
|
|
757
|
+
|
|
758
|
+
Every process that may receive a given attach must have the same root key (a
|
|
759
|
+
multi-instance HTTP deployment sets `VGI_SIGNING_KEY`). A runtime with no filesystem
|
|
760
|
+
(browser, Workers) and no signing key cannot accept a secret option: the ATTACH fails
|
|
761
|
+
and says so. Secret values, the key and the blob are never logged.
|
|
762
|
+
|
|
712
763
|
### Attach tickets: reattach as a user without their options (`vgi.attach_tickets.v1`)
|
|
713
764
|
|
|
714
765
|
A grant says *who* attaches; an **attach ticket** says *what*. While a user is
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const ATTACH_SECRET_KEY_FILE_ENV = "VGI_ATTACH_SECRET_KEY_FILE";
|
|
2
|
+
/** The key file path this process uses, per the cross-SDK rules above. */
|
|
3
|
+
export declare function hostLocalAttachSecretKeyPath(env?: Record<string, string | undefined>): string;
|
|
4
|
+
/**
|
|
5
|
+
* Read (creating on first use) the host-local key file at `path`
|
|
6
|
+
* (default {@link hostLocalAttachSecretKeyPath}). Synchronous and uncached;
|
|
7
|
+
* see {@link hostLocalAttachSecretKey} for the cached form the framework uses.
|
|
8
|
+
*/
|
|
9
|
+
export declare function loadHostLocalAttachSecretKey(path?: string): Uint8Array;
|
|
10
|
+
/** The host-local root key, read once per process (per resolved path). */
|
|
11
|
+
export declare function hostLocalAttachSecretKey(): Promise<Uint8Array>;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/** HKDF `info`, and the AAD prefix (before the 0x00 and the attach uuid). */
|
|
2
|
+
export declare const ATTACH_SECRET_OPTIONS_INFO = "vgi.attach_secret_options.v1";
|
|
3
|
+
/** First byte of the secret blob: XChaCha20-Poly1305 with a 24-byte nonce. */
|
|
4
|
+
export declare const ATTACH_SECRET_OPTIONS_VERSION = 1;
|
|
5
|
+
/** A decoded ATTACH options record: option name → value, as `attach()` got it. */
|
|
6
|
+
export type AttachOptionValues = Readonly<Record<string, unknown>>;
|
|
7
|
+
/**
|
|
8
|
+
* Where the secret-options root key comes from. `explicit` is the optional
|
|
9
|
+
* `attachSecretKey` configuration; `signingKey` the HTTP sealing key.
|
|
10
|
+
* `hostLocal` is resolved lazily, and only when a secret option has a value.
|
|
11
|
+
*/
|
|
12
|
+
export interface AttachSecretKeySource {
|
|
13
|
+
explicit?: Uint8Array | undefined;
|
|
14
|
+
signingKey?: Uint8Array | undefined;
|
|
15
|
+
/** Override for tests; defaults to the host-local key file. */
|
|
16
|
+
hostLocal?: (() => Promise<Uint8Array>) | undefined;
|
|
17
|
+
}
|
|
18
|
+
/** Raised when a secret option has a value but no key can be obtained. */
|
|
19
|
+
export declare class AttachSecretKeyUnavailableError extends Error {
|
|
20
|
+
constructor(message: string);
|
|
21
|
+
}
|
|
22
|
+
/** Raised by {@link attachOptions} for bytes the framework did not hand out. */
|
|
23
|
+
export declare class AttachOptionsUnavailableError extends Error {
|
|
24
|
+
constructor();
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The AEAD key for secret ATTACH options derived from `root`:
|
|
28
|
+
* HKDF-SHA256(ikm = root, salt = empty, info = "vgi.attach_secret_options.v1", L = 32).
|
|
29
|
+
* The root itself is never used as the cipher key.
|
|
30
|
+
*/
|
|
31
|
+
export declare function deriveAttachSecretKey(root: Uint8Array): Promise<Uint8Array>;
|
|
32
|
+
/**
|
|
33
|
+
* The trailer the framework appends to `uuid || catalog_bytes` for an attach
|
|
34
|
+
* with options, or an empty array when there are none. Encrypts the secret
|
|
35
|
+
* options (obtaining the key only if there is one); never logs anything.
|
|
36
|
+
*
|
|
37
|
+
* @throws {AttachSecretKeyUnavailableError} A secret option has a value and no key can be obtained.
|
|
38
|
+
*/
|
|
39
|
+
export declare function packAttachOptionsTrailer(uuid: Uint8Array, optionsIpc: Uint8Array | null | undefined, secretNames: ReadonlySet<string>, keys: AttachSecretKeySource, fixedNonce?: Uint8Array): Promise<Uint8Array>;
|
|
40
|
+
/**
|
|
41
|
+
* Turn a FULL framework attach plaintext (`uuid || catalog_bytes [|| trailer]`,
|
|
42
|
+
* already unsealed on HTTP) into the catalog's own bytes, decrypting any
|
|
43
|
+
* secret options and recording all options for {@link attachOptions}.
|
|
44
|
+
*
|
|
45
|
+
* Returns a view of a private copy, so the record cannot be confused with
|
|
46
|
+
* other bytes of the request. A value shorter than a UUID passes through
|
|
47
|
+
* as-is (with no options), as before.
|
|
48
|
+
*
|
|
49
|
+
* @throws {OpaqueDataRejectedError} The trailer is malformed or the secret blob
|
|
50
|
+
* does not open (wrong key, tampered, or moved from another attach).
|
|
51
|
+
*/
|
|
52
|
+
export declare function openFrameworkAttach(full: Uint8Array, keys: AttachSecretKeySource): Promise<Uint8Array>;
|
|
53
|
+
/**
|
|
54
|
+
* The ATTACH options of the attach a call belongs to — every supplied option,
|
|
55
|
+
* secret ones included, decoded exactly as `CatalogInterface.attach()`
|
|
56
|
+
* received them.
|
|
57
|
+
*
|
|
58
|
+
* Pass the attach value the framework handed the call: `bindCall.attach_opaque_data`
|
|
59
|
+
* (bind, and `initCall.bind_call` at init/process, for every function kind), a
|
|
60
|
+
* table-buffering function's `attachId`, or the `attachOpaqueData` argument of
|
|
61
|
+
* a catalog method or transaction hook (`transactionBegin` / `transactionCommit`
|
|
62
|
+
* / `transactionRollback`). Any subarray of those bytes works too; a copy does
|
|
63
|
+
* not.
|
|
64
|
+
*
|
|
65
|
+
* Secret options (declared `secret: true`) reach this accessor on every
|
|
66
|
+
* transport without ever being in plaintext in `attach_opaque_data`: the
|
|
67
|
+
* framework encrypts them inside the attach value with a worker-held key. A
|
|
68
|
+
* catalog therefore never needs to pack options into its own attach bytes,
|
|
69
|
+
* and must not put a secret there.
|
|
70
|
+
*
|
|
71
|
+
* Returns `{}` for a null attach value (a call outside any attach) and for
|
|
72
|
+
* an attach that had no options.
|
|
73
|
+
*
|
|
74
|
+
* @throws {AttachOptionsUnavailableError} The bytes were not handed out by the framework.
|
|
75
|
+
*/
|
|
76
|
+
export declare function attachOptions(attachOpaqueData: Uint8Array | null | undefined): AttachOptionValues;
|
|
77
|
+
/**
|
|
78
|
+
* One option from {@link attachOptions}, looked up case-insensitively (DuckDB
|
|
79
|
+
* option names are case-insensitive). `undefined` when it was not supplied.
|
|
80
|
+
*/
|
|
81
|
+
export declare function attachOption(attachOpaqueData: Uint8Array | null | undefined, name: string): unknown;
|
|
82
|
+
/**
|
|
83
|
+
* Names (lower-cased) of the options `catalog` declares `secret: true` for
|
|
84
|
+
* catalog `name`, read from what it advertises in `catalogsInfo()` — the same
|
|
85
|
+
* specs the extension redacts by — or its `attachOptionSpecs(name)`.
|
|
86
|
+
*/
|
|
87
|
+
export declare function secretAttachOptionNames(catalog: {
|
|
88
|
+
catalogsInfo?(): unknown;
|
|
89
|
+
attachOptionSpecs?(name: string): Array<{
|
|
90
|
+
name: string;
|
|
91
|
+
secret?: boolean;
|
|
92
|
+
}>;
|
|
93
|
+
}, name: string, deserialize: (bytes: Uint8Array) => {
|
|
94
|
+
name: string;
|
|
95
|
+
secret?: boolean;
|
|
96
|
+
}): Promise<Set<string>>;
|
|
@@ -50,6 +50,12 @@ export interface AttachOptionSpec {
|
|
|
50
50
|
* api_key getenv('SALES_API_KEY'));
|
|
51
51
|
* ```
|
|
52
52
|
*
|
|
53
|
+
* Functions and transaction hooks read the value with `attachOptions()`
|
|
54
|
+
* (`CatalogInterface.attachOptions()` in hooks), like any other option: the
|
|
55
|
+
* framework carries it to them encrypted inside `attach_opaque_data` with a
|
|
56
|
+
* worker-held key, so it is never in plaintext in any opaque value. Never
|
|
57
|
+
* put a secret into your catalog's own attach bytes.
|
|
58
|
+
*
|
|
53
59
|
* Combines with `required` (a credential the catalog cannot attach without,
|
|
54
60
|
* which a client can then ask for before attaching). It is allowed together
|
|
55
61
|
* with `default`, but a secret option normally has none: a default would be
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { VgiSchema, VgiDataType } from "../arrow/index.js";
|
|
2
2
|
import type { AttachCatalogInfo } from "./interface.js";
|
|
3
3
|
import type { AttachOptionSpec } from "./attach-option.js";
|
|
4
|
+
import type { WriteOperation, WriteResultMode } from "../write-results.js";
|
|
4
5
|
import type { VgiFunction } from "../functions/types.js";
|
|
5
6
|
import type { Arguments } from "../arguments/arguments.js";
|
|
6
7
|
import type { ColumnStatistics } from "../util/statistics.js";
|
|
@@ -33,6 +34,35 @@ export interface TableDescriptor {
|
|
|
33
34
|
columns?: VgiSchema;
|
|
34
35
|
function?: VgiFunction;
|
|
35
36
|
arguments?: Arguments;
|
|
37
|
+
/**
|
|
38
|
+
* Table in-out function backing `INSERT INTO <table>`. It receives the new
|
|
39
|
+
* rows (the table's user columns) and returns a `writeResultSchema` batch
|
|
40
|
+
* for the mode in its `write_options` (see `write-results.ts`). Omitted
|
|
41
|
+
* means the table does not accept INSERT.
|
|
42
|
+
*/
|
|
43
|
+
insertFunction?: VgiFunction;
|
|
44
|
+
/**
|
|
45
|
+
* Table in-out function backing `UPDATE <table>`. It receives the changed
|
|
46
|
+
* columns plus the row-id column (`rowIdField()`, which the scan
|
|
47
|
+
* `function` must emit) for each updated row. Requires `function`, which
|
|
48
|
+
* must also support projection pushdown and be listed in the schema's
|
|
49
|
+
* `functions` (see `rowIdField`).
|
|
50
|
+
*/
|
|
51
|
+
updateFunction?: VgiFunction;
|
|
52
|
+
/**
|
|
53
|
+
* Table in-out function backing `DELETE FROM <table>`. It receives the
|
|
54
|
+
* row-id column of each deleted row. Requires `function`, with the same
|
|
55
|
+
* projection-pushdown conditions as `updateFunction`.
|
|
56
|
+
*/
|
|
57
|
+
deleteFunction?: VgiFunction;
|
|
58
|
+
/**
|
|
59
|
+
* The richest result mode each write function produces: `count` (plain
|
|
60
|
+
* DML), `rows` (`RETURNING`) or `changes` (old/new pairs). Ordered
|
|
61
|
+
* `count < rows < changes`; supporting one mode promises every lower one.
|
|
62
|
+
* An operation with a write function but no entry defaults to `count`.
|
|
63
|
+
* Mirrors vgi-python's `Table.write_result_modes`.
|
|
64
|
+
*/
|
|
65
|
+
writeResultModes?: Partial<Record<WriteOperation, WriteResultMode>>;
|
|
36
66
|
/** @deprecated Not sent under vgi.v3 (serving throws). Use `constraints: [constraintRecord({ kind: "NOT_NULL", ... })]`. */
|
|
37
67
|
notNull?: string[];
|
|
38
68
|
/** @deprecated Not sent under vgi.v3 (serving throws). Use `constraints: [constraintRecord({ kind: "UNIQUE", ... })]`. */
|
|
@@ -108,6 +108,18 @@ export interface ScanFunctionResult {
|
|
|
108
108
|
*/
|
|
109
109
|
schemaPath: string[] | null;
|
|
110
110
|
}
|
|
111
|
+
/**
|
|
112
|
+
* The `ScanFunctionResult` wire record as a catalog method returns it:
|
|
113
|
+
* `tableScanFunctionGet` (untyped, for history) and the write-function lookups
|
|
114
|
+
* `tableInsertFunctionGet` / `tableUpdateFunctionGet` / `tableDeleteFunctionGet`.
|
|
115
|
+
* `arguments` is the serialized inner arguments batch.
|
|
116
|
+
*/
|
|
117
|
+
export interface ScanFunctionResultRecord {
|
|
118
|
+
function_name: string;
|
|
119
|
+
arguments: Uint8Array;
|
|
120
|
+
required_extensions: string[];
|
|
121
|
+
schema_path: string[] | null;
|
|
122
|
+
}
|
|
111
123
|
/**
|
|
112
124
|
* Encode a ScanFunctionResult wire record — the single-row batch shape
|
|
113
125
|
* `{ function_name, arguments, required_extensions, schema_path }` that
|
|
@@ -405,6 +417,22 @@ export declare abstract class CatalogInterface {
|
|
|
405
417
|
tableConstraintsApply(request: ConstraintsApplyRequest): Promise<ConstraintSnapshot>;
|
|
406
418
|
tableDrop(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, ignoreNotFound?: boolean, transactionOpaqueData?: TransactionOpaqueData): Awaitable<void>;
|
|
407
419
|
tableScanFunctionGet(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, atUnit?: string, atValue?: string, transactionOpaqueData?: TransactionOpaqueData): Awaitable<any>;
|
|
420
|
+
/**
|
|
421
|
+
* The table in-out function backing `INSERT INTO` this table. Default:
|
|
422
|
+
* the table is read-only. `writableBranchFunctionName` names the writable
|
|
423
|
+
* arm of a multi-branch table (null for a single-branch one).
|
|
424
|
+
*/
|
|
425
|
+
tableInsertFunctionGet(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, transactionOpaqueData?: TransactionOpaqueData, writableBranchFunctionName?: string | null): Awaitable<ScanFunctionResultRecord>;
|
|
426
|
+
/**
|
|
427
|
+
* The table in-out function backing `UPDATE` of this table. Its input is the
|
|
428
|
+
* changed columns plus the row-id column. Default: the table is read-only.
|
|
429
|
+
*/
|
|
430
|
+
tableUpdateFunctionGet(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, transactionOpaqueData?: TransactionOpaqueData): Awaitable<ScanFunctionResultRecord>;
|
|
431
|
+
/**
|
|
432
|
+
* The table in-out function backing `DELETE FROM` this table. Its input is
|
|
433
|
+
* the row-id column. Default: the table is read-only.
|
|
434
|
+
*/
|
|
435
|
+
tableDeleteFunctionGet(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, transactionOpaqueData?: TransactionOpaqueData): Awaitable<ScanFunctionResultRecord>;
|
|
408
436
|
/**
|
|
409
437
|
* Return the scan branches for a (possibly multi-source) table. Default
|
|
410
438
|
* delegates to `tableScanFunctionGet` and wraps the single result as a
|
|
@@ -492,6 +520,21 @@ export declare abstract class CatalogInterface {
|
|
|
492
520
|
* worker cache. `this`, except for a composite, which routes to its backend.
|
|
493
521
|
*/
|
|
494
522
|
catalogContentsOwner(_attachOpaqueData: AttachOpaqueData): CatalogInterface;
|
|
523
|
+
/**
|
|
524
|
+
* The ATTACH options of the attach `attachOpaqueData` belongs to — every
|
|
525
|
+
* supplied option, secret ones (`AttachOptionSpec.secret`) included, as
|
|
526
|
+
* `attach()` received them. Works in every catalog method and transaction
|
|
527
|
+
* hook (`transactionBegin` / `transactionCommit` / `transactionRollback`)
|
|
528
|
+
* on the `attachOpaqueData` argument it was given; functions use the
|
|
529
|
+
* standalone {@link attachOptions} on `bindCall.attach_opaque_data`.
|
|
530
|
+
*
|
|
531
|
+
* The framework carries the options inside `attach_opaque_data` itself and
|
|
532
|
+
* encrypts the secret ones with a worker-held key, so they never appear in
|
|
533
|
+
* plaintext in any opaque value on any transport. An `attach()` override
|
|
534
|
+
* therefore never needs to pack options into its own attach bytes, and must
|
|
535
|
+
* not put a credential there.
|
|
536
|
+
*/
|
|
537
|
+
attachOptions(attachOpaqueData: AttachOpaqueData): Readonly<Record<string, unknown>>;
|
|
495
538
|
transactionBegin(attachOpaqueData: AttachOpaqueData): Awaitable<Uint8Array | null>;
|
|
496
539
|
transactionCommit(attachOpaqueData: AttachOpaqueData, transactionOpaqueData: TransactionOpaqueData): Awaitable<void>;
|
|
497
540
|
transactionRollback(attachOpaqueData: AttachOpaqueData, transactionOpaqueData: TransactionOpaqueData): Awaitable<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CatalogInterface, type AttachOpaqueData, type TransactionOpaqueData, type CatalogAttachResult, type SchemaInfo, type CatalogInfo, type TableInfo, type ViewInfo, type FunctionInfo, type MacroInfo, type IndexInfo, type CopyFromFormatInfo } from "./interface.js";
|
|
1
|
+
import { CatalogInterface, type AttachOpaqueData, type TransactionOpaqueData, type CatalogAttachResult, type SchemaInfo, type CatalogInfo, type TableInfo, type ViewInfo, type FunctionInfo, type MacroInfo, type IndexInfo, type CopyFromFormatInfo, type ScanFunctionResultRecord } from "./interface.js";
|
|
2
2
|
import { type CatalogDescriptor } from "./descriptors.js";
|
|
3
3
|
import type { FunctionRegistry } from "../functions/registry.js";
|
|
4
4
|
import { type AttachOptionSpec } from "./attach-option.js";
|
|
@@ -93,7 +93,16 @@ export declare class ReadOnlyCatalogInterface extends CatalogInterface {
|
|
|
93
93
|
* `constraints`; override when tables are served outside the descriptor.
|
|
94
94
|
*/
|
|
95
95
|
catalogReadProfiles(): string[];
|
|
96
|
-
/**
|
|
96
|
+
/**
|
|
97
|
+
* Write profiles this catalog implements. A table that carries constraint
|
|
98
|
+
* records AND has a write function makes the catalog advertise
|
|
99
|
+
* `vgi.constraint.enforce.v1`: DuckDB only writes to a constrained table
|
|
100
|
+
* when the provider promises to keep its ENFORCED constraints, so such a
|
|
101
|
+
* table's write functions must reject rows that would violate them (for
|
|
102
|
+
* instance by refusing to change key columns).
|
|
103
|
+
*/
|
|
104
|
+
catalogWriteProfiles(): string[];
|
|
105
|
+
/** The descriptor's profiles: records are served, never mutated here; writable constrained tables enforce. */
|
|
97
106
|
catalogCapabilities(_attachOpaqueData: AttachOpaqueData): CatalogCapabilities | null;
|
|
98
107
|
detach(attachOpaqueData: AttachOpaqueData): void;
|
|
99
108
|
version(attachOpaqueData: AttachOpaqueData, transactionOpaqueData?: TransactionOpaqueData): number | Promise<number>;
|
|
@@ -143,6 +152,11 @@ export declare class ReadOnlyCatalogInterface extends CatalogInterface {
|
|
|
143
152
|
indexGet(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, transactionOpaqueData?: TransactionOpaqueData): IndexInfo | null;
|
|
144
153
|
macroGet(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, transactionOpaqueData?: TransactionOpaqueData): MacroInfo | null;
|
|
145
154
|
tableScanFunctionGet(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, atUnit?: string, atValue?: string, transactionOpaqueData?: TransactionOpaqueData): any;
|
|
155
|
+
/** The write function for `operation`, or a read-only / not-found error. */
|
|
156
|
+
private _writeFunctionGet;
|
|
157
|
+
tableInsertFunctionGet(_attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, _transactionOpaqueData?: TransactionOpaqueData, _writableBranchFunctionName?: string | null): ScanFunctionResultRecord;
|
|
158
|
+
tableUpdateFunctionGet(_attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, _transactionOpaqueData?: TransactionOpaqueData): ScanFunctionResultRecord;
|
|
159
|
+
tableDeleteFunctionGet(_attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, _transactionOpaqueData?: TransactionOpaqueData): ScanFunctionResultRecord;
|
|
146
160
|
tableGet(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, atUnit?: string, atValue?: string, transactionOpaqueData?: TransactionOpaqueData): Promise<TableInfo | null>;
|
|
147
161
|
viewGet(attachOpaqueData: AttachOpaqueData, schemaPath: string[], name: string, transactionOpaqueData?: TransactionOpaqueData): ViewInfo | null;
|
|
148
162
|
copyFromFormats(attachOpaqueData: AttachOpaqueData, transactionOpaqueData?: TransactionOpaqueData): CopyFromFormatInfo[];
|
package/dist/client-entry.js
CHANGED