Skip to main content

SdkManifestBuilder

@webda/sdk


Class: SdkManifestBuilder

Defined in: sdk/src/manifest.ts:168

Build the SdkManifest of the current application: needs a resolved Core

REST routes are read from the router, so nested models, custom primary keys, queryMethod and nameTransformer are honoured without duplicating the transport's logic. At the resolved phase (build hooks) the REST transport has not registered its routes yet: the builder asks it to, which only touches the in-memory router.

Constructors​

Constructor​

new SdkManifestBuilder(options?): SdkManifestBuilder

Defined in: sdk/src/manifest.ts:172

Parameters​

options?​

SdkManifestBuilderOptions = {}

what to describe

Returns​

SdkManifestBuilder

Properties​

options​

protected options: SdkManifestBuilderOptions = {}

Defined in: sdk/src/manifest.ts:172

what to describe

Methods​

build()​

build(): SdkManifest

Defined in: sdk/src/manifest.ts:296

Returns​

SdkManifest

the manifest


ensureRoutes()​

protected ensureRoutes(rest): void

Defined in: sdk/src/manifest.ts:210

Make sure the REST routes are registered: at the resolved phase the transport has not run init() yet

Parameters​

rest​

RESTOperationsTransport

the REST transport

Returns​

void


modelOf()​

protected modelOf(op): string | undefined

Defined in: sdk/src/manifest.ts:281

Parameters​

op​

OperationDefinition

an operation definition

Returns​

string | undefined

the model id the operation works on


relationsOf()​

protected relationsOf(id, relations, models): ModelGraph

Defined in: sdk/src/manifest.ts:255

Copy relations, resolving legacy query target type names to real attributes. Current metadata records the third argument of ModelRelated<Target, This, "attribute">; older metadata recorded the second argument instead. Preserve explicit attributes and use the target's parent or a case-insensitive schema match for legacy metadata.

Parameters​

id​

string

the model id

relations​

ModelGraph

its metadata relations (frozen)

models​

Record<string, any>

every model class, by id

Returns​

ModelGraph

a copy of the relations


restRoutes()​

protected restRoutes(rest): Map<string, { method: HttpMethod; path: string; pathParams: string[]; query?: string[]; } | undefined>

Defined in: sdk/src/manifest.ts:221

The REST route of every operation, from the router's openapi.<method>.operationId

Parameters​

rest​

RESTOperationsTransport

the REST transport

Returns​

Map<string, { method: HttpMethod; path: string; pathParams: string[]; query?: string[]; } | undefined>

operation id to route


restTransport()​

protected restTransport(): RESTOperationsTransport<RESTOperationsTransportParameters> | undefined

Defined in: sdk/src/manifest.ts:201

Returns​

RESTOperationsTransport<RESTOperationsTransportParameters> | undefined

the REST transport, when configured


serviceOf()​

protected serviceOf(name): any

Defined in: sdk/src/manifest.ts:185

Parameters​

name​

string

constructor name (GraphQLService, GrpcService, SyncService)

Returns​

any

the first configured service of that class, by duck typing on the class chain


services()​

protected services(): Record<string, any>

Defined in: sdk/src/manifest.ts:177

Returns​

Record<string, any>

the configured services, by constructor name