schema
schema is a module in @cipherstash/stack. TypeScript API reference with its signature, parameters, and usage.
schema
Type Aliases
CastAs
type CastAs = z.infer<typeof castAsEnum>;Defined in: schema/internal.ts:183
Type-safe alias for castAsEnum used to specify the unencrypted data type of a column or value. This is important because once encrypted, all data is stored as binary blobs.
See
castAsEnum for possible values.
EqlCastAs
type EqlCastAs = z.infer<typeof eqlCastAsEnum>;Defined in: schema/internal.ts:184
Low-level encryption configuration primitives.
Schema authoring is EQL v3-only; import encryptedTable and types from
@cipherstash/stack/v3. This subpath remains for packages that inspect or
validate the generated protect-ffi configuration.
TokenFilter
type TokenFilter = z.infer<typeof tokenFilterSchema>;Defined in: schema/internal.ts:185
Low-level encryption configuration primitives.
Schema authoring is EQL v3-only; import encryptedTable and types from
@cipherstash/stack/v3. This subpath remains for packages that inspect or
validate the generated protect-ffi configuration.
MatchIndexOpts
type MatchIndexOpts = z.infer<typeof matchIndexOptsSchema>;Defined in: schema/internal.ts:186
Low-level encryption configuration primitives.
Schema authoring is EQL v3-only; import encryptedTable and types from
@cipherstash/stack/v3. This subpath remains for packages that inspect or
validate the generated protect-ffi configuration.
SteVecIndexOpts
type SteVecIndexOpts = z.infer<typeof steVecIndexOptsSchema>;Defined in: schema/internal.ts:187
Low-level encryption configuration primitives.
Schema authoring is EQL v3-only; import encryptedTable and types from
@cipherstash/stack/v3. This subpath remains for packages that inspect or
validate the generated protect-ffi configuration.
UniqueIndexOpts
type UniqueIndexOpts = z.infer<typeof uniqueIndexOptsSchema>;Defined in: schema/internal.ts:188
Low-level encryption configuration primitives.
Schema authoring is EQL v3-only; import encryptedTable and types from
@cipherstash/stack/v3. This subpath remains for packages that inspect or
validate the generated protect-ffi configuration.
OreIndexOpts
type OreIndexOpts = z.infer<typeof oreIndexOptsSchema>;Defined in: schema/internal.ts:189
Low-level encryption configuration primitives.
Schema authoring is EQL v3-only; import encryptedTable and types from
@cipherstash/stack/v3. This subpath remains for packages that inspect or
validate the generated protect-ffi configuration.
OpeIndexOpts
type OpeIndexOpts = z.infer<typeof opeIndexOptsSchema>;Defined in: schema/internal.ts:190
Low-level encryption configuration primitives.
Schema authoring is EQL v3-only; import encryptedTable and types from
@cipherstash/stack/v3. This subpath remains for packages that inspect or
validate the generated protect-ffi configuration.
ColumnSchema
type ColumnSchema = z.infer<typeof columnSchema>;Defined in: schema/internal.ts:191
Low-level encryption configuration primitives.
Schema authoring is EQL v3-only; import encryptedTable and types from
@cipherstash/stack/v3. This subpath remains for packages that inspect or
validate the generated protect-ffi configuration.
EncryptConfig
type EncryptConfig = z.infer<typeof encryptConfigSchema>;Defined in: schema/internal.ts:212
Low-level encryption configuration primitives.
Schema authoring is EQL v3-only; import encryptedTable and types from
@cipherstash/stack/v3. This subpath remains for packages that inspect or
validate the generated protect-ffi configuration.
Variables
eqlCastAsEnum
const eqlCastAsEnum: ZodDefault<ZodEnum<["text", "int", "small_int", "big_int", "real", "double", "boolean", "date", "timestamp", "jsonb"]>>;Defined in: schema/internal.ts:32
EQL cast types — the PostgreSQL-aligned types that EQL actually accepts.
These are stored in the cast_as field of the EncryptConfig.
castAsEnum
const castAsEnum: ZodDefault<ZodEnum<["bigint", "boolean", "date", "timestamp", "number", "string", "json", "text"]>>;Defined in: schema/internal.ts:54
SDK-facing data types — developer-friendly aliases accepted by dataType().
timestamp is distinct from date: date is calendar-date only (time-of-day
truncated to midnight), while timestamp preserves the full date+time. v3
timestamp domains set cast_as: 'timestamp' so the FFI keeps the instant.
Functions
toEqlCastAs()
function toEqlCastAs(value):
| "boolean"
| "date"
| "text"
| "int"
| "small_int"
| "big_int"
| "real"
| "double"
| "timestamp"
| "jsonb";Defined in: schema/internal.ts:73
Map SDK-facing data types to EQL cast_as values.
The SDK accepts developer-friendly types like 'string' and 'number',
but EQL expects PostgreSQL-aligned types like 'text' and 'double'.
Parameters
value
"string" | "number" | "bigint" | "boolean" | "date" | "text" | "timestamp" | "json"
Returns
| "boolean"
| "date"
| "text"
| "int"
| "small_int"
| "big_int"
| "real"
| "double"
| "timestamp"
| "jsonb"