Skip to content

RepositoryService

Defined in: repository-service.ts:44

A concrete Service<T> over any Repository<T> — the framework-owned bridge from ServiceParams.query (raw strings from HTTP) to QueryParams.

Query conventions (see the Phase 4 TDD, section 14):

  • Reserved keys inside query: $limit, $skip, $sort, $select; everything else is where.
  • find() ALWAYS returns Paginated<T> — total via repository.count({ where }).
  • With options.fields, unknown where/sort/select fields throw BadRequest.
  • With options.schema, string where-values are coerced to the field’s declared type; without one they pass through unchanged.
  • update/patch/remove propagate the repository’s NotFound untouched.

For a service backed by more than one repository (e.g. writing an activity-log entry alongside the primary record), compose them directly behind a hand-written Service<T> instead — see “Services with multiple repositories” in the root README.

T

D = Partial<T>

new RepositoryService<T, D>(repository, options?): RepositoryService<T, D>

Defined in: repository-service.ts:45

Repository<T, D>

RepositoryServiceOptions = {}

RepositoryService<T, D>

protected readonly options: RepositoryServiceOptions = {}

Defined in: repository-service.ts:47


protected readonly repository: Repository<T, D>

Defined in: repository-service.ts:46

protected assertFields(where): void

Defined in: repository-service.ts:179

Record<string, unknown>

void


create(data, _params?): Promise<T>

Defined in: repository-service.ts:83

D

ServiceParams

Promise<T>

Service.create

create(data, _params?): Promise<T[]>

Defined in: repository-service.ts:84

D[]

ServiceParams

Promise<T[]>

Service.create


describe(): RepositoryCapabilities | undefined

Defined in: repository-service.ts:105

Surface the underlying repository’s capabilities so ServiceHandle.describe() can include them.

RepositoryCapabilities | undefined


find(params?): Promise<Paginated<T>>

Defined in: repository-service.ts:50

ServiceParams

Promise<Paginated<T>>

Service.find


get(id, _params?): Promise<T>

Defined in: repository-service.ts:75

Id

ServiceParams

Promise<T>

Service.get


protected parseQuery(query): ParsedQuery

Defined in: repository-service.ts:111

Record<string, unknown>

ParsedQuery


patch(id, data, _params?): Promise<T>

Defined in: repository-service.ts:96

Id

D

ServiceParams

Promise<T>

Service.patch


remove(id, _params?): Promise<T>

Defined in: repository-service.ts:100

Id

ServiceParams

Promise<T>

Service.remove


update(id, data, _params?): Promise<T>

Defined in: repository-service.ts:92

Id

D

ServiceParams

Promise<T>

Service.update