@webda/graphql 4.0.0-beta.1 → 4.0.0-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/graphql.d.ts DELETED
@@ -1,170 +0,0 @@
1
- import { Application, CoreModel, CoreModelDefinition, DeepPartial, DomainService, DomainServiceParameters, ModelGraph, WebContext } from "@webda/core";
2
- import * as WebdaQL from "@webda/ql";
3
- import { FieldNode, GraphQLFieldConfig, GraphQLResolveInfo, GraphQLSchema, GraphQLType, ThunkObjMap } from "graphql";
4
- import { Handler } from "graphql-http";
5
- import { Server as GraphQLWSServer } from "graphql-ws";
6
- import { JSONSchema7 } from "json-schema";
7
- import { WebSocketServer } from "ws";
8
- export interface GraphQLContextExtension {
9
- /**
10
- * Get the current count of operation for this request
11
- */
12
- count?: number;
13
- }
14
- /**
15
- * Parameters for the GraphQL service
16
- */
17
- export declare class GraphQLParameters extends DomainServiceParameters {
18
- /**
19
- * Max number of requests allowed within a graphql query or mutation
20
- *
21
- * @default 10
22
- */
23
- maxOperationsPerRequest: number;
24
- /**
25
- * User model to expose
26
- * @default User
27
- */
28
- userModel: string;
29
- /**
30
- * Expose current user in the context with me
31
- * @default true
32
- */
33
- exposeMe: boolean;
34
- /**
35
- * Expose the schema
36
- */
37
- exposeGraphiQL: boolean;
38
- /**
39
- * Expose a aggregation of all available subscriptions
40
- */
41
- globalSubscription: boolean;
42
- constructor(params: any);
43
- }
44
- /**
45
- * Implement a GraphQL service
46
- *
47
- * It will expose all your exposed models as GraphQL types
48
- * Dynamically generate the schema
49
- *
50
- * @WebdaModda
51
- */
52
- export declare class GraphQLService<T extends GraphQLParameters = GraphQLParameters> extends DomainService<T> {
53
- schema: GraphQLSchema;
54
- handler: Handler;
55
- modelsMap: {};
56
- app: Application;
57
- wss: WebSocketServer;
58
- wsHandler: GraphQLWSServer;
59
- modelListeners: any;
60
- loadParameters(params: DeepPartial<T>): GraphQLParameters;
61
- /**
62
- *
63
- * @param prop
64
- * @param definitions
65
- * @returns
66
- */
67
- getJsonSchemaDefinition(prop: JSONSchema7, definitions?: {}): JSONSchema7;
68
- /**
69
- *
70
- * @param schema
71
- * @param defaultName
72
- * @returns
73
- */
74
- getGraphQLSchemaFromSchema(schema: JSONSchema7, defaultName: string, input?: boolean): {
75
- type: GraphQLType;
76
- description?: string;
77
- };
78
- /**
79
- * Add the GraphQL schema results
80
- * @param type
81
- * @returns
82
- */
83
- getGraphQLQueryResult(type: any): any;
84
- /**
85
- *
86
- * @param schema
87
- * @param defaultName
88
- * @param webdaGraph
89
- * @returns
90
- */
91
- getGraphQLFieldsFromSchema(schema: JSONSchema7, defaultName: string, webdaGraph?: ModelGraph, input?: boolean): any;
92
- /**
93
- * Load model with filter on attributes
94
- * @param knownFieldsOrId
95
- * @param model
96
- * @param context
97
- * @param info
98
- * @returns
99
- */
100
- loadModelInstance(knownFieldsOrId: string | {
101
- uuid: string;
102
- [key: string]: any;
103
- }, model: CoreModelDefinition, context: WebContext, info?: FieldNode, filter?: WebdaQL.PartialValidator): Promise<CoreModel | {
104
- [key: string]: any;
105
- uuid: string;
106
- }>;
107
- /**
108
- * Count the number of operations done with graphql
109
- * @param context
110
- */
111
- countOperation(context: WebContext, increment?: number): void;
112
- resolve(): this;
113
- /**
114
- * Generate GraphQL schema
115
- */
116
- generateSchema(): void;
117
- /**
118
- * Return the events to subscribe to
119
- * @param info
120
- * @returns
121
- */
122
- getSubscribedEvents(info: GraphQLResolveInfo): string[];
123
- /**
124
- *
125
- * @param model
126
- * @param arg1
127
- * @param context
128
- * @returns
129
- */
130
- registerAsyncIteratorQuery(model: CoreModelDefinition<CoreModel>, plural: string, query: string, context: any): Promise<AsyncIterator<any>>;
131
- /**
132
- *
133
- * @param model
134
- * @param uuid
135
- * @param context
136
- * @returns
137
- */
138
- registerAsyncIterator(model: CoreModelDefinition<CoreModel>, uuid: any, context: any, identifier?: string): Promise<AsyncIterator<any>>;
139
- /**
140
- *
141
- * @param model
142
- * @param uuid
143
- * @param context
144
- * @returns
145
- */
146
- registerAsyncEventIterator(model: CoreModelDefinition<CoreModel>, uuid: string | null, events: string[], context: any, identifier: string): Promise<AsyncIterator<any>>;
147
- /**
148
- *
149
- * @param rootFields
150
- * @param mutation
151
- * @returns
152
- */
153
- getGraphQLSchema(rootFields: ThunkObjMap<GraphQLFieldConfig<any, any, any>>, mutations?: ThunkObjMap<GraphQLFieldConfig<any, any, any>>, subscription?: ThunkObjMap<GraphQLFieldConfig<any, any, any>>): GraphQLSchema;
154
- /**
155
- * @override
156
- */
157
- init(): Promise<this>;
158
- handleModel(model: CoreModelDefinition<CoreModel>, name: string, context: any): boolean;
159
- /**
160
- * Serve schema and graphqli
161
- * @params ctx
162
- */
163
- schemaRoute(ctx: WebContext<any>): Promise<void>;
164
- /**
165
- * Endpoint for the GraphQL schema
166
- * @param ctx
167
- * @returns
168
- */
169
- endpoint(ctx: WebContext<any>): Promise<void>;
170
- }