EncryptedColumn
API reference for EncryptedColumn
Class: EncryptedColumn
Defined in: .tmp-stack/packages/stack/src/schema/index.ts:182
Constructors
Constructor
new EncryptedColumn(columnName): EncryptedColumn;Defined in: .tmp-stack/packages/stack/src/schema/index.ts:192
Parameters
columnName
string
Returns
EncryptedColumn
Methods
dataType()
dataType(castAs): EncryptedColumn;Defined in: .tmp-stack/packages/stack/src/schema/index.ts:214
Set or override the plaintext data type for this column.
By default all columns are treated as 'string'. Use this method to specify
a different type so the encryption layer knows how to encode the plaintext
before encrypting.
Parameters
castAs
The plaintext data type: 'string', 'number', 'boolean', 'date', 'bigint', or 'json'.
"string" | "number" | "bigint" | "boolean" | "date" | "json" | "text"
Returns
EncryptedColumn
This EncryptedColumn instance for method chaining.
Example
import { encryptedColumn } from "@cipherstash/stack/schema"
const dateOfBirth = encryptedColumn("date_of_birth").dataType("date")orderAndRange()
orderAndRange(): EncryptedColumn;Defined in: .tmp-stack/packages/stack/src/schema/index.ts:236
Enable Order-Revealing Encryption (ORE) indexing on this column.
ORE allows sorting, comparison, and range queries on encrypted data.
Use with encryptQuery and queryType: 'orderAndRange'.
Returns
EncryptedColumn
This EncryptedColumn instance for method chaining.
Example
import { encryptedTable, encryptedColumn } from "@cipherstash/stack/schema"
const users = encryptedTable("users", {
email: encryptedColumn("email").orderAndRange(),
})equality()
equality(tokenFilters?): EncryptedColumn;Defined in: .tmp-stack/packages/stack/src/schema/index.ts:260
Enable an exact-match (unique) index on this column.
Allows equality queries on encrypted data. Use with encryptQuery
and queryType: 'equality'.
Parameters
tokenFilters?
{
kind: "downcase";
}[]
Optional array of token filters (e.g. [{ kind: 'downcase' }]).
When omitted, no token filters are applied.
Returns
EncryptedColumn
This EncryptedColumn instance for method chaining.
Example
import { encryptedTable, encryptedColumn } from "@cipherstash/stack/schema"
const users = encryptedTable("users", {
email: encryptedColumn("email").equality(),
})freeTextSearch()
freeTextSearch(opts?): EncryptedColumn;Defined in: .tmp-stack/packages/stack/src/schema/index.ts:295
Enable a full-text / fuzzy search (match) index on this column.
Uses n-gram tokenization by default for substring and fuzzy matching.
Use with encryptQuery and queryType: 'freeTextSearch'.
Parameters
opts?
Optional match index configuration. Defaults to 3-character ngram
tokenization with a downcase filter, k=6, m=2048, and include_original=true.
tokenizer?
| {
kind: "standard";
}
| {
kind: "ngram";
token_length: number;
} = tokenizerSchema
token_filters?
{
kind: "downcase";
}[] = ...
k?
number = ...
m?
number = ...
include_original?
boolean = ...
Returns
EncryptedColumn
This EncryptedColumn instance for method chaining.
Example
import { encryptedTable, encryptedColumn } from "@cipherstash/stack/schema"
const users = encryptedTable("users", {
email: encryptedColumn("email").freeTextSearch(),
})
// With custom options
const posts = encryptedTable("posts", {
body: encryptedColumn("body").freeTextSearch({
tokenizer: { kind: "ngram", token_length: 4 },
k: 8,
m: 4096,
}),
})searchableJson()
searchableJson(): EncryptedColumn;Defined in: .tmp-stack/packages/stack/src/schema/index.ts:333
Configure this column for searchable encrypted JSON (STE-Vec).
Enables encrypted JSONPath selector queries (e.g. '$.user.email') and
containment queries (e.g. { role: 'admin' }). Automatically sets the
data type to 'json'.
When used with encryptQuery, the query operation is auto-inferred from
the plaintext type: strings become selector queries, objects/arrays become
containment queries.
Returns
EncryptedColumn
This EncryptedColumn instance for method chaining.
Example
import { encryptedTable, encryptedColumn } from "@cipherstash/stack/schema"
const documents = encryptedTable("documents", {
metadata: encryptedColumn("metadata").searchableJson(),
})build()
build(): {
cast_as: "number" | "bigint" | "boolean" | "date" | "json" | "text";
indexes: {
ore?: {
};
unique?: {
token_filters?: {
kind: "downcase";
}[];
};
match?: Required<{
tokenizer?: | {
kind: "standard";
}
| {
kind: "ngram";
token_length: number;
};
token_filters?: {
kind: "downcase";
}[];
k?: number;
m?: number;
include_original?: boolean;
}>;
ste_vec?: {
prefix: string;
};
};
};Defined in: .tmp-stack/packages/stack/src/schema/index.ts:339
Returns
{
cast_as: "number" | "bigint" | "boolean" | "date" | "json" | "text";
indexes: {
ore?: {
};
unique?: {
token_filters?: {
kind: "downcase";
}[];
};
match?: Required<{
tokenizer?: | {
kind: "standard";
}
| {
kind: "ngram";
token_length: number;
};
token_filters?: {
kind: "downcase";
}[];
k?: number;
m?: number;
include_original?: boolean;
}>;
ste_vec?: {
prefix: string;
};
};
}cast_as
cast_as: "number" | "bigint" | "boolean" | "date" | "json" | "text";indexes
indexes: {
ore?: {
};
unique?: {
token_filters?: {
kind: "downcase";
}[];
};
match?: Required<{
tokenizer?: | {
kind: "standard";
}
| {
kind: "ngram";
token_length: number;
};
token_filters?: {
kind: "downcase";
}[];
k?: number;
m?: number;
include_original?: boolean;
}>;
ste_vec?: {
prefix: string;
};
};indexes.ore?
optional ore: {
};indexes.unique?
optional unique: {
token_filters?: {
kind: "downcase";
}[];
};indexes.unique.token_filters?
optional token_filters: {
kind: "downcase";
}[];indexes.match?
optional match: Required<{
tokenizer?: | {
kind: "standard";
}
| {
kind: "ngram";
token_length: number;
};
token_filters?: {
kind: "downcase";
}[];
k?: number;
m?: number;
include_original?: boolean;
}>;indexes.ste_vec?
optional ste_vec: {
prefix: string;
};indexes.ste_vec.prefix
prefix: string;getName()
getName(): string;Defined in: .tmp-stack/packages/stack/src/schema/index.ts:346
Returns
string