Skip to main content

SdkManifestBuilder

@webda/sdk


Class: SdkManifestBuilder

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

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:232

Create a new SdkManifestBuilder instance

Parameters​

options?​

SdkManifestBuilderOptions = {}

what to describe

Returns​

SdkManifestBuilder

Properties​

options​

protected options: SdkManifestBuilderOptions = {}

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

what to describe

Methods​

build()​

build(): SdkManifest

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

Build operation

Returns​

SdkManifest

the manifest


ensureRoutes()​

protected ensureRoutes(rest): void

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

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:353

Return the model id the operation works on

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:326

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, RestExposure | undefined>

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

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

Parameters​

rest​

RESTOperationsTransport

the REST transport

Returns​

Map<string, RestExposure | undefined>

operation id to route


restTransport()​

protected restTransport(): RESTOperationsTransport<RESTOperationsTransportParameters> | undefined

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

Return the REST transport, when configured

Returns​

RESTOperationsTransport<RESTOperationsTransportParameters> | undefined

the REST transport, when configured


serviceOf()​

protected serviceOf(name): any

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

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

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:238

Return the configured services, by constructor name

Returns​

Record<string, any>

the configured services, by constructor name