Skip to main content

GraphQLService

@webda/graphql


Class: GraphQLService<T>

Defined in: graphql/src/graphql.service.ts:194

Implement a GraphQL service

It will expose all your exposed models as GraphQL types Dynamically generate the schema

Webda Modda​

Extends​

  • DomainService<T>

Type Parameters​

T​

T extends GraphQLParameters = GraphQLParameters

Constructors​

Constructor​

new GraphQLService<T>(name, params): GraphQLService<T>

Defined in: core/lib/services/service.d.ts:72

Service

Parameters​

name​

string

The name of the service

params​

T

The parameters block define in the configuration file

Returns​

GraphQLService<T>

Inherited from​

DomainService<T>.constructor

Properties​

_compiledCapabilities​

protected _compiledCapabilities: Record<string, any>

Defined in: core/lib/services/iservice.d.ts:39

Capabilities detected at compile-time from @WebdaCapability-tagged interfaces.

Populated during Service.resolve by reading the service's entry in webda.module.json. Each key is a capability name (e.g., "request-filter"), and the value is an empty object {} by default. Override getCapabilities to provide capability-specific configuration or to conditionally disable capabilities.

See​

getCapabilities

Inherited from​

DomainService._compiledCapabilities


[WEBDA_EVENTS]​

[WEBDA_EVENTS]: DomainServiceEvents

Defined in: core/lib/services/service.d.ts:50

Set the Webda events here

Inherited from​

DomainService.[WEBDA_EVENTS]


app​

app: Application

Defined in: graphql/src/graphql.service.ts:198

Overrides​

DomainService.app


handler​

handler: Handler

Defined in: graphql/src/graphql.service.ts:196


logger​

protected logger: Logger

Defined in: core/lib/services/service.d.ts:59

Logger with class context

Inherited from​

DomainService.logger


metrics?​

protected optional metrics?: object

Defined in: core/lib/services/service.d.ts:63

Get metrics

Inherited from​

DomainService.metrics


modelListeners​

modelListeners: any

Defined in: graphql/src/graphql.service.ts:201


modelsMap​

modelsMap: object

Defined in: graphql/src/graphql.service.ts:197

Index Signature​

[key: string]: GraphQLObjectType<any, any>


name​

readonly name: string

Defined in: core/lib/services/iservice.d.ts:19

Inherited from​

DomainService.name


parameters​

readonly parameters: T

Defined in: core/lib/services/iservice.d.ts:20

Inherited from​

DomainService.parameters


schema​

schema: GraphQLSchema

Defined in: graphql/src/graphql.service.ts:195


wsHandler​

wsHandler: Server

Defined in: graphql/src/graphql.service.ts:200


wss​

wss: WebSocketServer

Defined in: graphql/src/graphql.service.ts:199


createConfiguration?​

static optional createConfiguration?: (params) => any

Defined in: core/lib/services/iservice.d.ts:24

Create configuration set by the application on load

Parameters​

params​

any

Returns​

any

Inherited from​

DomainService.createConfiguration


filterConfiguration?​

static optional filterConfiguration?: (params) => any

Defined in: core/lib/services/iservice.d.ts:28

Create configuration set by the application on load

Parameters​

params​

any

Returns​

any

Inherited from​

DomainService.filterConfiguration


Parameters​

static Parameters: typeof ServiceParameters

Defined in: core/lib/services/service.d.ts:46

Service parameters

Inherited from​

DomainService.Parameters


schemas​

static schemas: object

Defined in: core/lib/services/domainservice.service.d.ts:147

searchRequest​

searchRequest: object

searchRequest.properties​

properties: object

searchRequest.properties.query​

query: object

searchRequest.properties.query.type​

type: string

searchRequest.type​

type: string

uuidRequest​

uuidRequest: object

uuidRequest.properties​

properties: object

uuidRequest.properties.uuid​

uuid: object

uuidRequest.properties.uuid.type​

type: string

uuidRequest.required​

required: string[]

uuidRequest.type​

type: string

Inherited from​

DomainService.schemas

Methods​

__clean()​

abstract __clean(): Promise<void>

Defined in: core/lib/services/service.d.ts:215

Clean the service data, can only be used in test mode

Returns​

Promise<void>

Inherited from​

DomainService.__clean


addBehaviorOperations()​

addBehaviorOperations(model, Metadata, name): void

Defined in: core/lib/services/domainservice.service.d.ts:285

Register one operation per declared action on every Behavior attribute of the model. Operation ids follow the <Model>.<Attribute>.<Action> shape so transports can discover them with the same lookup logic used for model-level operations.

The actual dispatch is deferred to modelBehaviorAction. This method only wires the registry entries — it does not invoke behaviors.

Parameters​

model​

ModelClass<Model>

the model class owning the behavior attribute

Metadata​

any

the model metadata blob (with Relations.behaviors)

name​

string

the model's short identifier (e.g. "User")

Returns​

void

Inherited from​

DomainService.addBehaviorOperations


addListener()​

addListener<Key>(eventName, listener): this

Defined in: core/lib/events/asynceventemitter.d.ts:80

Type Parameters​

Key​

Key extends "Store.WebNotFound"

Parameters​

eventName​

Key

the event name

listener​

(event) => void | Promise<void>

the event listener

Returns​

this

this for chaining

See​

EventEmitter.addListener

Inherited from​

DomainService.addListener


addRoute()​

protected addRoute(url, methods, executer, openapi?, override?): void

Defined in: core/lib/services/service.d.ts:177

Add a route dynamicaly

Parameters​

url​

string

of the route can contains dynamic part like {uuid}

methods​

HttpMethodType[]

the HTTP methods

executer​

Function

Method to execute for this route

openapi?​

OpenAPIWebdaDefinition

the OpenAPI specification

override?​

boolean

whether to override existing

Returns​

void

Inherited from​

DomainService.addRoute


authorizeClientEvent()​

authorizeClientEvent(_event, _context): boolean

Defined in: core/lib/services/service.d.ts:153

Authorize a public event subscription

Parameters​

_event​

string

the event name

_context​

OperationContext

the execution context

Returns​

boolean

true if the condition is met

Inherited from​

DomainService.authorizeClientEvent


checkParent()​

protected checkParent(model, parentId, context): Promise<void>

Defined in: core/lib/services/domainservice.service.d.ts:203

checkModelParent, emitting Store.WebNotFound when the parent is missing or unreadable, like any missing object

Parameters​

model​

ModelClass<Model>

the child model class

parentId​

any

the parent primary key

context​

OperationContext

the caller context

Returns​

Promise<void>

Inherited from​

DomainService.checkParent


checkPermission()​

protected checkPermission(object, context, action, model?): Promise<void>

Defined in: core/lib/services/domainservice.service.d.ts:189

checkModelPermission, emitting Store.WebNotFound when the refusal looks like a missing object, exactly like loadModel does for a missing key

Parameters​

object​

Model

the model instance

context​

OperationContext

the caller context

action​

string

the action

model?​

ModelClass<Model>

the model class (the static canAct asked)

Returns​

Promise<void>

Inherited from​

DomainService.checkPermission


checkReparent()​

protected checkReparent(model, object, input, context): Promise<void>

Defined in: core/lib/services/domainservice.service.d.ts:221

When an update moves an object to another parent, the caller must be able to read the new parent

Parameters​

model​

ModelClass<Model>

the model class

object​

Model

the stored object

input​

any

the sanitized input

context​

OperationContext

the caller context

Returns​

Promise<void>

Inherited from​

DomainService.checkReparent


computeParameters()​

computeParameters(): void

Defined in: core/lib/services/service.d.ts:77

Used to compute or derivate input parameter to attribute

Returns​

void

Deprecated​

Inherited from​

DomainService.computeParameters


countOperation()​

countOperation(context, increment?): void

Defined in: graphql/src/graphql.service.ts:579

Increment the operation counter and throw if the per-request limit is exceeded

Parameters​

context​

WebContext

web context holding the graphql extension with the counter

increment?​

number = 1

number of operations to add (default 1)

Returns​

void


emit()​

emit<Key>(event, data): Promise<void>

Defined in: core/lib/services/service.d.ts:204

Emit the event with data and wait for Promise to finish if listener returned a Promise

Type Parameters​

Key​

Key extends "Store.WebNotFound"

Parameters​

event​

Key

the event name

data​

DomainServiceEvents[Key]

the data to process

Returns​

Promise<void>

Inherited from​

DomainService.emit


endpoint()​

endpoint(ctx): Promise<void>

Defined in: graphql/src/graphql.service.ts:1289

Handle POST requests to the GraphQL endpoint

Parameters​

ctx​

WebContext<any>

incoming web context with the GraphQL query body

Returns​

Promise<void>


generateSchema()​

generateSchema(): void

Defined in: graphql/src/graphql.service.ts:622

Generate GraphQL schema

Returns​

void


getCapabilities()​

getCapabilities(): Record<string, any>

Defined in: core/lib/services/iservice.d.ts:61

Return the capabilities of this service.

By default returns capabilities detected at compile-time from

Returns​

Record<string, any>

the result

Webda Capability-tagged​

interfaces in webda.module.json.

Override to disable capabilities based on configuration:

getCapabilities() {
const caps = super.getCapabilities();
if (!this.parameters.enabled) delete caps["request-filter"];
return caps;
}

Inherited from​

DomainService.getCapabilities


getClientEvents()​

getClientEvents(): string[]

Defined in: core/lib/services/service.d.ts:144

Return the events that an external system can subscribe to

Returns​

string[]

the list of results

Inherited from​

DomainService.getClientEvents


getGraphQLFieldsFromSchema()​

getGraphQLFieldsFromSchema(schema, defaultName, webdaGraph?, input?, writable?): any

Defined in: graphql/src/graphql.service.ts:324

Build GraphQL field definitions from a JSON Schema, enriching with relation resolvers from the model graph

Parameters​

schema​

JSONSchema7

JSON Schema describing the model properties

defaultName​

string

fallback name for generated types

webdaGraph?​

ModelGraph

model relation graph (links, maps, queries, parent)

input?​

boolean

if true, generate input types (skip readonly fields, skip relation resolvers)

writable?​

string[] = []

_-prefixed attributes the model accepts from clients (input types only)

Returns​

any

map of field names to GraphQL field configs


getGraphQLQueryResult()​

getGraphQLQueryResult(type): GraphQLObjectType<any, any>

Defined in: graphql/src/graphql.service.ts:299

Get or create a GraphQL query result wrapper type with results array and continuationToken

Parameters​

type​

any

GraphQL object type to wrap in a query result

Returns​

GraphQLObjectType<any, any>

GraphQL object type with results and continuationToken fields


getGraphQLSchema()​

getGraphQLSchema(rootFields, mutations?, subscription?): GraphQLSchema

Defined in: graphql/src/graphql.service.ts:1142

Assemble the final GraphQLSchema from root query fields, mutations, and subscriptions

Parameters​

rootFields​

ThunkObjMap<GraphQLFieldConfig<any, any, any>>

top-level query fields

mutations?​

ThunkObjMap<GraphQLFieldConfig<any, any, any>> = {}

mutation fields

subscription?​

ThunkObjMap<GraphQLFieldConfig<any, any, any>> = {}

subscription fields

Returns​

GraphQLSchema

the constructed GraphQLSchema


getGraphQLSchemaFromSchema()​

getGraphQLSchemaFromSchema(schema, defaultName, input?): object

Defined in: graphql/src/graphql.service.ts:237

Convert a JSON Schema to a GraphQL type definition

Parameters​

schema​

JSONSchema7

JSON Schema to convert

defaultName​

string

fallback name for anonymous types

input?​

boolean

if true, generate GraphQLInputObjectType instead of GraphQLObjectType

Returns​

object

object with the GraphQL type and optional description, or undefined for null types

description?​

optional description?: string

type​

type: GraphQLType


getJsonSchemaDefinition()​

getJsonSchemaDefinition(prop, definitions?): JSONSchema7

Defined in: graphql/src/graphql.service.ts:217

Resolve a JSON Schema property by following $ref pointers

Parameters​

prop​

JSONSchema7

JSON Schema property that may contain $ref

definitions?​

schema definitions map for resolving references

Returns​

JSONSchema7

the resolved JSON Schema (or a null type if unresolvable)


getMaxListeners()​

getMaxListeners(): number

Defined in: core/lib/events/asynceventemitter.d.ts:84

Returns​

number

Inherited from​

DomainService.getMaxListeners


getMetric()​

getMetric<T>(type, configuration): T

Defined in: core/lib/services/service.d.ts:138

Add service name label

Type Parameters​

T​

T = Gauge<string> | Counter<string> | Histogram<string>

Parameters​

type​

CustomConstructor<T, [MetricConfiguration<T>]>

the type to look up

configuration​

MetricConfiguration<T>

the configuration

Returns​

T

the result

Inherited from​

DomainService.getMetric


getName()​

getName(): string

Defined in: core/lib/services/service.d.ts:209

Get service name

Returns​

string

the result string

Inherited from​

DomainService.getName


getOpenApiReplacements()​

getOpenApiReplacements(): any

Defined in: core/lib/services/service.d.ts:182

Return variables for replacement in openapi

Returns​

any

the result

Inherited from​

DomainService.getOpenApiReplacements


getOperationId()​

getOperationId(id): string

Defined in: core/lib/services/service.d.ts:167

If undefined is returned it cancel the operation registration

Parameters​

id​

string

the identifier

Returns​

string

the result

Inherited from​

DomainService.getOperationId


getParameters()​

getParameters(): T

Defined in: core/lib/services/service.d.ts:82

Get the service parameters

Returns​

T

the result

Inherited from​

DomainService.getParameters


getService()​

getService<T>(name): ServicesMap[T]

Defined in: core/lib/services/service.d.ts:131

Get a service by name

Type Parameters​

T​

T extends keyof ServicesMap

Parameters​

name​

T

the name to use

Returns​

ServicesMap[T]

the result map

Deprecated​

Use useService, might reconsider

Inherited from​

DomainService.getService


getState()​

getState(): ServiceStates

Defined in: core/lib/services/service.d.ts:55

Get the current state

Returns​

ServiceStates

the result

Inherited from​

DomainService.getState


getSubscribedEvents()​

getSubscribedEvents(info): string[]

Defined in: graphql/src/graphql.service.ts:950

Extract the list of event names from the GraphQL selection set (excluding latestEventTime)

Parameters​

info​

GraphQLResolveInfo

GraphQL resolve info containing field selections

Returns​

string[]

array of event name strings the client subscribed to


getUrl()​

getUrl(url, _methods): string

Defined in: core/lib/services/service.d.ts:161

Return the full path url based on parameters

Parameters​

url​

string

relative url to service

_methods​

HttpMethodType[]

in case we need filtering (like Store)

Returns​

string

absolute url or undefined if need to skip the Route

Inherited from​

DomainService.getUrl


handleModel()​

handleModel(model, name, context): boolean

Defined in: graphql/src/graphql.service.ts:1238

Check whether a model should be handled by this service (always returns true)

Parameters​

model​

ModelDefinition<any>

model class to check

name​

string

display name of the model

context​

any

request context

Returns​

boolean

true if the model should be processed


init()​

init(): Promise<GraphQLService<T>>

Defined in: graphql/src/graphql.service.ts:1171

Returns​

Promise<GraphQLService<T>>

Overrides​

DomainService.init


initMetrics()​

initMetrics(): void

Defined in: core/lib/services/service.d.ts:124

Init the metrics

Returns​

void

Inherited from​

DomainService.initMetrics


initOperations()​

initOperations(): void

Defined in: core/lib/services/domainservice.service.d.ts:271

Add operations for all exposed models

Returns​

void

the result

Inherited from​

DomainService.initOperations


isExposable()​

isExposable(model, identifier): boolean

Defined in: core/lib/services/domainservice.service.d.ts:266

Whether a model may be exposed: models of INTERNAL_MODELS and their subclasses need an explicit listing in the models parameter

Parameters​

model​

any

model class

identifier​

string

model identifier

Returns​

boolean

true when the model may be exposed

Inherited from​

DomainService.isExposable


listeners()​

listeners(eventName): Function[]

Defined in: core/lib/events/asynceventemitter.d.ts:139

Get all listeners for an event

Parameters​

eventName​

"Store.WebNotFound"

the event name

Returns​

Function[]

the list of results

Inherited from​

DomainService.listeners


loadCapabilities()​

protected loadCapabilities(): void

Defined in: core/lib/services/service.d.ts:120

Load capabilities from webda.module.json metadata into _compiledCapabilities.

Called during resolve after dependency injection. Reads the service's type name from parameters, looks it up in the application's module metadata (moddas or beans section), and populates _compiledCapabilities with an empty object for each declared capability name.

Fails silently if the application is not available (e.g., in unit tests where services are instantiated without a full application context).

Returns​

void

Example​

// If webda.module.json contains:
// { "moddas": { "MyApp/HawkService": { "capabilities": ["request-filter", "cors-filter"] } } }
// Then after resolve(), this.getCapabilities() returns:
// { "request-filter": {}, "cors-filter": {} }

See​

getCapabilities

Inherited from​

DomainService.loadCapabilities


loadListedInstance()​

loadListedInstance(knownFieldsOrId, model, context, info?, filter?): Promise<any>

Defined in: graphql/src/graphql.service.ts:509

loadModelInstance for an element of a list (links, maps): an element the caller may not read, or that no longer exists, is dropped (null) instead of failing the whole list, like a filtered query

Parameters​

knownFieldsOrId​

string | {[key: string]: any; uuid: string; }

UUID string or object with known field values

model​

ModelDefinition<any>

model class to load from

context​

WebContext

web context for permission checks

info?​

FieldNode

GraphQL field node describing the selection set

filter?​

PartialValidator

optional WebdaQL filter to apply to the result

Returns​

Promise<any>

the model instance, or null


loadModelInstance()​

loadModelInstance(knownFieldsOrId, model, context, info?, filter?): Promise<any>

Defined in: graphql/src/graphql.service.ts:535

Load a model instance, optimizing to skip store reads when all requested fields are already known

Parameters​

knownFieldsOrId​

string | {[key: string]: any; uuid: string; }

UUID string or object with known field values

model​

ModelDefinition<any>

model class to load from

context​

WebContext

web context for permission checks

info?​

FieldNode

GraphQL field node describing the selection set

filter?​

PartialValidator

optional WebdaQL filter to apply to the result

Returns​

Promise<any>

the model instance, or null if filtered out


loadParameters()​

loadParameters(params): GraphQLParameters

Defined in: graphql/src/graphql.service.ts:207

Load and initialize GraphQL service parameters

Parameters​

params​

any

raw partial configuration

Returns​

GraphQLParameters

initialized GraphQLParameters


log()​

log(level, ...args): void

Defined in: core/lib/services/service.d.ts:226

Parameters​

level​

WorkerLogLevel

to log

args​

...any[]

additional arguments

Returns​

void

Inherited from​

DomainService.log


modelAction()​

modelAction(...args): Promise<any>

Defined in: core/lib/services/domainservice.service.d.ts:258

Action on a model

Parameters​

args​

...any[]

arguments forwarded to the action method

Returns​

Promise<any>

the action result

Inherited from​

DomainService.modelAction


modelBehaviorAction()​

modelBehaviorAction(...args): Promise<any>

Defined in: core/lib/services/domainservice.service.d.ts:311

Dispatcher for a behavior-attribute action registered by addBehaviorOperations. Mirrors the shape of modelAction:

  1. read the parent model class + attribute/action names off operationContext (set up by callOperation),
  2. take args[0] as the parent UUID (Behavior actions are always instance-scoped per the spec),
  3. load the parent via model.ref(uuid).get() — NotFound if missing or soft-deleted,
  4. ask the model whether the action is allowed via canAct(ctx, "<attribute>.<action>") — anything but true (or the instance itself, the convention some models use to say "yes, on this object") is treated as a denial,
  5. read instance[attribute] — already a hydrated Behavior instance thanks to CoreModel.deserialize (Task 7),
  6. call behaviorInstance[action](...args.slice(1)) and let callOperation write the result onto the context.

Parameters​

args​

...any[]

resolved arguments from resolveArguments; the first is always the parent UUID, the rest come from the request body / query params depending on the registered input schema.

Returns​

Promise<any>

the Behavior method's return value (callOperation writes it to the context output if non-undefined).

Inherited from​

DomainService.modelBehaviorAction


modelCreate()​

modelCreate(input): Promise<Model>

Defined in: core/lib/services/domainservice.service.d.ts:195

Create a model operation implementation

Parameters​

input​

any

the model data to create

Returns​

Promise<Model>

the created model instance

Inherited from​

DomainService.modelCreate


modelDelete()​

modelDelete(uuid): Promise<void>

Defined in: core/lib/services/domainservice.service.d.ts:239

Delete a model operation implementation

Parameters​

uuid​

string

the model primary key

Returns​

Promise<void>

Inherited from​

DomainService.modelDelete


modelGet()​

modelGet(uuid): Promise<Model>

Defined in: core/lib/services/domainservice.service.d.ts:234

Get a model operation implementation

Parameters​

uuid​

string

the model primary key

Returns​

Promise<Model>

the model instance

Inherited from​

DomainService.modelGet


modelPatch()​

modelPatch(input?): Promise<Model>

Defined in: core/lib/services/domainservice.service.d.ts:252

Patch a model

Parameters​

input?​

any

the partial update data (may be undefined if schema was not resolvable)

Returns​

Promise<Model>

the patched model instance

Inherited from​

DomainService.modelPatch


modelQuery()​

modelQuery(query): Promise<any>

Defined in: core/lib/services/domainservice.service.d.ts:245

Query models

Parameters​

query​

string

the query string

Returns​

Promise<any>

the query results

Inherited from​

DomainService.modelQuery


modelUpdate()​

modelUpdate(input?): Promise<Model>

Defined in: core/lib/services/domainservice.service.d.ts:228

Update a model operation implementation

Parameters​

input?​

any

the update data (may be undefined if schema was not resolvable)

Returns​

Promise<Model>

the updated model instance

Inherited from​

DomainService.modelUpdate


off()​

off<Key>(eventName, listener): this

Defined in: core/lib/events/asynceventemitter.d.ts:116

Type Parameters​

Key​

Key extends "Store.WebNotFound"

Parameters​

eventName​

Key

the event name

listener​

(event) => void

the event listener

Returns​

this

this for chaining

See​

EventEmitter.off

Inherited from​

DomainService.off


on()​

on<Key>(eventName, listener): this

Defined in: core/lib/events/asynceventemitter.d.ts:102

Type Parameters​

Key​

Key extends "Store.WebNotFound"

Parameters​

eventName​

Key

the event name

listener​

(event) => void

the event listener

Returns​

this

this for chaining

See​

EventEmitter.once

Inherited from​

DomainService.on


once()​

once<Key>(eventName, listener): this

Defined in: core/lib/events/asynceventemitter.d.ts:95

Type Parameters​

Key​

Key extends "Store.WebNotFound"

Parameters​

eventName​

Key

the event name

listener​

(event) => void

the event listener

Returns​

this

this for chaining

See​

EventEmitter.once

Inherited from​

DomainService.once


parseFilter()​

parseFilter(filter?): PartialValidator

Defined in: graphql/src/graphql.service.ts:484

Parse the filter argument of a links or maps field: WebdaQL evaluated on the linked objects, which may not read private (__) fields

Parameters​

filter?​

string

the client filter

Returns​

PartialValidator

the validator, undefined without filter

Throws​

GraphQLError BAD_USER_INPUT for an invalid filter or one reading private fields


queryRelated()​

queryRelated(related, model, query, context): Promise<{ continuationToken?: string; results: any[]; }>

Defined in: graphql/src/graphql.service.ts:966

Query a 1:n relation (ModelRelated) as the caller: the relation condition is merged into the client query, then filtered like any model query (permission query, canAct "get")

Parameters​

the ModelRelated attribute of the source object

getQuery​

merges the relation condition into a query

model​

any

the target model class

query​

string

the client query

context​

any

the caller context

Returns​

Promise<{ continuationToken?: string; results: any[]; }>

the readable related objects


registerAsyncEventIterator()​

registerAsyncEventIterator(model, uuid, events, context, identifier): Promise<AsyncIterator<any, any, any>>

Defined in: graphql/src/graphql.service.ts:1098

Create an async iterator for raw model events (not full objects), filtered by event name and UUID

Parameters​

model​

ModelDefinition<any>

model class to listen on

uuid​

string

UUID to filter events for, or null for all instances

events​

string[]

list of event names the client wants to receive

context​

any

web context for authorization checks

identifier​

string

key used as the iterator prefix

Returns​

Promise<AsyncIterator<any, any, any>>

async iterator yielding event payloads with latestEventTime


registerAsyncIterator()​

registerAsyncIterator(model, uuid, context, identifier?): Promise<AsyncIterator<any, any, any>>

Defined in: graphql/src/graphql.service.ts:1047

Create an async iterator that streams a single model instance, updating on store events

Parameters​

model​

ModelDefinition<any>

model class the instance belongs to

uuid​

any

UUID of the specific instance to watch

context​

any

web context for permission checks

identifier?​

string

optional key used as the iterator prefix (defaults to model identifier)

Returns​

Promise<AsyncIterator<any, any, any>>

async iterator yielding the updated model on each store change


registerAsyncIteratorQuery()​

registerAsyncIteratorQuery(model, plural, query, context): Promise<AsyncIterator<any, any, any>>

Defined in: graphql/src/graphql.service.ts:983

Create an async iterator that streams query results, updating when store events occur

Parameters​

model​

ModelDefinition<any>

model class to query

plural​

string

plural name used as the iterator prefix key

query​

string

WebdaQL query string

context​

any

web context for permission checks

Returns​

Promise<AsyncIterator<any, any, any>>

async iterator yielding updated query results on store changes


removeAllListeners()​

removeAllListeners<Key>(eventName?): this

Defined in: core/lib/events/asynceventemitter.d.ts:122

Type Parameters​

Key​

Key extends "Store.WebNotFound"

Parameters​

eventName?​

Key

the event name

Returns​

this

this for chaining

See​

EventEmitter.removeAllListeners

Inherited from​

DomainService.removeAllListeners


removeListener()​

removeListener<Key>(eventName, listener): this

Defined in: core/lib/events/asynceventemitter.d.ts:109

Type Parameters​

Key​

Key extends "Store.WebNotFound"

Parameters​

eventName​

Key

the event name

listener​

(event) => void

the event listener

Returns​

this

this for chaining

See​

EventEmitter.removeListener

Inherited from​

DomainService.removeListener


resolve()​

resolve(): GraphQLService<T>

Defined in: graphql/src/graphql.service.ts:598

Set up WebSocket server for GraphQL subscriptions and register upgrade handler

Returns​

GraphQLService<T>

this instance for chaining

Overrides​

DomainService.resolve


resolveUpdateKey()​

protected resolveUpdateKey(input, pkFields, params): any

Defined in: core/lib/services/domainservice.service.d.ts:213

Resolve the primary key of an update or patch: the URL parameters win over the body, and a body carrying another key is refused, so an update can never be redirected to another object

Parameters​

input​

any

the sanitized input, its primary-key fields are removed

pkFields​

string[]

the primary-key fields

params​

Record<string, any>

the URL parameters

Returns​

any

the primary key

Throws​

BadRequest when the body key differs from the URL key

Inherited from​

DomainService.resolveUpdateKey


schemaRoute()​

schemaRoute(ctx): Promise<void>

Defined in: graphql/src/graphql.service.ts:1248

Serve the GraphQL schema as text or the GraphiQL IDE as HTML

Parameters​

ctx​

WebContext<any>

incoming web context

Returns​

Promise<void>


setMaxListeners()​

setMaxListeners(n): this

Defined in: core/lib/events/asynceventemitter.d.ts:88

Parameters​

n​

number

Returns​

this

Inherited from​

DomainService.setMaxListeners


stop()​

stop(): Promise<void>

Defined in: core/lib/services/service.d.ts:86

Shutdown the current service if action need to be taken

Returns​

Promise<void>

Inherited from​

DomainService.stop


toJSON()​

toJSON(): string

Defined in: core/lib/services/service.d.ts:191

Prevent service to be serialized

Returns​

string

the result

Inherited from​

DomainService.toJSON


toString()​

toString(): string

Defined in: core/lib/services/service.d.ts:91

Return service representation

Returns​

string

the result

Inherited from​

DomainService.toString


transformName()​

transformName(name): string

Defined in: core/lib/services/domainservice.service.d.ts:173

Return the model name for this service

Parameters​

name​

string

the name to use

Returns​

string

the result string

See​

https://blog.boot.dev/clean-code/casings-in-coding/#:~:text=%F0%9F%94%97%20Camel%20Case,Go

Inherited from​

DomainService.transformName