@voltro/database 0.11.3 → 0.12.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/CHANGELOG.md +436 -0
- package/dist/{fileBased-BrYB2u6E.js → fileBased-DEW2BvnP.js} +110 -100
- package/dist/index.d.ts +59 -1
- package/dist/index.js +584 -573
- package/dist/sql.d.ts +13 -0
- package/dist/sql.js +4 -4
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -492,6 +492,16 @@ export declare const clearRetentions: () => void;
|
|
|
492
492
|
/** Wipe — used by tests + the dev-loop hot-reload. */
|
|
493
493
|
export declare const clearTableRegistry: () => void;
|
|
494
494
|
|
|
495
|
+
/**
|
|
496
|
+
* The value to bind for `column`, given what the table declares it as.
|
|
497
|
+
* Returns `value` unchanged whenever nothing unambiguous applies — including
|
|
498
|
+
* for an unknown column, which the column AUDIT reports rather than this.
|
|
499
|
+
*/
|
|
500
|
+
export declare const coercePredicateValue: (columnType: ColumnType | undefined, value: unknown) => unknown;
|
|
501
|
+
|
|
502
|
+
/** Same, for the array-valued operators (`inSet` / `notInSet`). */
|
|
503
|
+
export declare const coercePredicateValues: (columnType: ColumnType | undefined, values: ReadonlyArray<unknown>) => ReadonlyArray<unknown>;
|
|
504
|
+
|
|
495
505
|
/**
|
|
496
506
|
* Walk a predicate tree + yield every sub-query descriptor. The
|
|
497
507
|
* store calls this before evaluating to know which sub-queries to
|
|
@@ -545,6 +555,19 @@ export declare class ColumnBuilder<TsType, Type extends ColumnType, HasDefault e
|
|
|
545
555
|
* ciphertext on disk) — encrypt only what you read back whole.
|
|
546
556
|
*/
|
|
547
557
|
encrypted(): this;
|
|
558
|
+
/**
|
|
559
|
+
* Mark this column SERVER-INTERNAL: server code reads it, but it must never be
|
|
560
|
+
* serialized to a client. The EXPOSURE axis, distinct from `.encrypted()`
|
|
561
|
+
* (storage-at-rest) — a `keyHash` an auth middleware verifies is `serverOnly`,
|
|
562
|
+
* a private note the owner may read is `encrypted` but not.
|
|
563
|
+
*
|
|
564
|
+
* keyHash: text().serverOnly(),
|
|
565
|
+
*
|
|
566
|
+
* A column is exposed to both server and client by default; this opts it OUT of
|
|
567
|
+
* the client. The `crud.*` read helpers strip it from every returned row, and
|
|
568
|
+
* the boot audit fails a wire-reachable query that declares it in its output.
|
|
569
|
+
*/
|
|
570
|
+
serverOnly(): this;
|
|
548
571
|
/**
|
|
549
572
|
* Classify this column as SENSITIVE — it holds personal / sensitive data of
|
|
550
573
|
* `class` (`'email'`, `'fullName'`, `'phone'`, `'address'`, `'secret'`, …).
|
|
@@ -973,6 +996,19 @@ export declare interface ColumnDefinition<TsType, Type extends ColumnType = Colu
|
|
|
973
996
|
* no cipher is registered.
|
|
974
997
|
*/
|
|
975
998
|
readonly encrypted?: boolean;
|
|
999
|
+
/**
|
|
1000
|
+
* Wire-exposure flag, set by `.serverOnly()`. When `true` the column is
|
|
1001
|
+
* SERVER-INTERNAL: server code reads it normally (an auth middleware verifying
|
|
1002
|
+
* a `keyHash`, say), but it must NEVER be serialized to a client. This is the
|
|
1003
|
+
* EXPOSURE axis, orthogonal to `.encrypted()` (which is storage-at-rest): a
|
|
1004
|
+
* column can be either, both, or neither — a hash you never ship is serverOnly
|
|
1005
|
+
* but not encrypted; a private note the owner may read is encrypted but not
|
|
1006
|
+
* serverOnly. The default is exposed to BOTH server and client; `.serverOnly()`
|
|
1007
|
+
* opts a column OUT of the client. The table-aware read paths (`crud.*`) strip
|
|
1008
|
+
* it automatically, and the boot audit flags a wire-reachable query whose
|
|
1009
|
+
* `source` table carries a serverOnly column that its output declares.
|
|
1010
|
+
*/
|
|
1011
|
+
readonly serverOnly?: boolean;
|
|
976
1012
|
/**
|
|
977
1013
|
* Data-sensitivity classification, set by `.sensitive(class)`. Declares that
|
|
978
1014
|
* this column holds personal / sensitive data of a given CLASS (`'email'`,
|
|
@@ -1200,7 +1236,19 @@ export declare const compileEagerJson: (descriptor: QueryDescriptor, sql: SqlCon
|
|
|
1200
1236
|
* WHERE clause. Identifiers are quoted via `sql(col)`; values flow through
|
|
1201
1237
|
* `sql\`${v}\`` as parameters — no string concatenation, no injection.
|
|
1202
1238
|
*/
|
|
1203
|
-
export declare const compilePredicate: (predicate: Predicate, sql: SqlConstructor, namespace?: QueryNamespace
|
|
1239
|
+
export declare const compilePredicate: (predicate: Predicate, sql: SqlConstructor, namespace?: QueryNamespace,
|
|
1240
|
+
/**
|
|
1241
|
+
* The table this predicate filters, when the caller knows it. Supplied so a
|
|
1242
|
+
* leaf's VALUE can be coerced to the column's shape — `eq('capturedAt',
|
|
1243
|
+
* epochMs)` against a `timestamp()` column otherwise compiles to
|
|
1244
|
+
* `WHERE capturedAt = 1767916800000` and matches nothing, silently. The write
|
|
1245
|
+
* path has always encoded; this closes the asymmetry.
|
|
1246
|
+
*
|
|
1247
|
+
* Optional because `compilePredicate` is also called for JOIN conditions and
|
|
1248
|
+
* by callers that hold only the AST. Absent → no coercion, i.e. exactly the
|
|
1249
|
+
* previous behaviour.
|
|
1250
|
+
*/
|
|
1251
|
+
table?: string) => Statement.Fragment;
|
|
1204
1252
|
|
|
1205
1253
|
/**
|
|
1206
1254
|
* Rebind a captured {@link RawSqlFragment} onto a live `sql`
|
|
@@ -4443,6 +4491,14 @@ export declare type SensitivityClass = 'email' | 'fullName' | 'firstName' | 'las
|
|
|
4443
4491
|
*/
|
|
4444
4492
|
export declare const serializeArraysForWrite: (row: Row, table: TableLike | undefined, dialect: DialectId) => Row;
|
|
4445
4493
|
|
|
4494
|
+
/**
|
|
4495
|
+
* The names of a table's SERVER-ONLY columns (`.serverOnly()`) — columns that
|
|
4496
|
+
* must never be serialized to a client. The table-aware read paths (`crud.*`)
|
|
4497
|
+
* strip these from every returned row, and the boot audit checks a wire query's
|
|
4498
|
+
* output against them. Pure — no store, no context.
|
|
4499
|
+
*/
|
|
4500
|
+
export declare const serverOnlyColumns: (table: TableLike) => ReadonlyArray<string>;
|
|
4501
|
+
|
|
4446
4502
|
/** Register the process-wide residency config (boot). Pass a config explicitly
|
|
4447
4503
|
* to the pure resolvers in tests instead. */
|
|
4448
4504
|
export declare const setResidencyConfig: (config: ResidencyConfig) => ResidencyConfig;
|
|
@@ -4514,6 +4570,8 @@ export declare interface SpatialSpec {
|
|
|
4514
4570
|
readonly bufferMeters?: number;
|
|
4515
4571
|
}
|
|
4516
4572
|
|
|
4573
|
+
export { SqlClient }
|
|
4574
|
+
|
|
4517
4575
|
export declare type SqlConstructor = Statement.Constructor;
|
|
4518
4576
|
|
|
4519
4577
|
/**
|