Skip to content

RepositoryOptions

Defined in: types.ts:178

Desc extends DescMessage

optional columns?: Record<string, ColumnConfig>

Defined in: types.ts:202

Per-field column configuration. Keys are proto field names (snake_case). See ColumnConfig for available options.

columns: {
uid: { name: "user_id" },
display_name: { name: "name" },
settings: { serialize: "json" },
create_time: { timestamp: "create" },
}

engine: Engine

Defined in: types.ts:180

The database engine to use.


optional etag?: object

Defined in: types.ts:234

Etag configuration. When the proto schema has an etag field, the repository computes and stores etags on create and update.

etag: {
field: "etag",
mask: fieldMask(MySchema, ["update_time"]),
fn: (schema, msg) => customEtag(schema, msg),
}

optional field?: string

Proto field name (snake_case) of the etag field. Defaults to "etag".

optional fn?: (schema, msg) => string

Custom etag generation function. Defaults to the etag function from @protoutil/aip/etag.

Desc

MessageShape<Desc>

string

optional mask?: FieldMask

A FieldMask applied to the resource before calculating its etag. Useful for excluding fields like update_time that change on every write but don’t represent a semantic change.


optional fieldMasks?: object

Defined in: types.ts:281

Default field masks applied to operations when no per-call mask is provided.

fieldMasks: {
read: fieldMask(MySchema, ["uid", "display_name", "email"]),
update: fieldMask(MySchema, ["display_name", "email"]),
}

optional read?: FieldMask

Default FieldMask for read operations (get, list). Per-call readMask overrides this. Defaults to "*" (all fields).

optional update?: FieldMask

Default FieldMask for update operations. Per-call updateMask overrides this. Defaults to "*" (all fields).


optional filterDecls?: Decl[]

Defined in: types.ts:209

Additional AIP-160 filter declarations merged with the auto-generated declarations from contextDecls(schema). Use this to register custom functions (e.g. ago()) or additional identifiers.


optional interceptors?: Interceptor<Desc>[]

Defined in: types.ts:220

Interceptors applied to every repository operation. Forms a middleware chain in array order (first interceptor is outermost). See Interceptor for the function signature.

interceptors: [loggingInterceptor, otelInterceptor]

optional pagination?: object

Defined in: types.ts:262

Pagination defaults for list operations.

pagination: { defaultSize: 25, maxSize: 200 }

optional defaultSize?: number

Default number of results per page. Defaults to 30.

optional maxSize?: number

Maximum allowed page size. Defaults to 100.


optional tableName?: string

Defined in: types.ts:187

Override the database table name. Defaults to the proto message’s full type name converted to snake_case (e.g. protoutil.repo.v1.TestUserprotoutil_repo_v1_test_user).