@orion-js/graphql 4.0.0-alpha.3 → 4.0.0-next.0
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/dist/index.cjs +11 -8
- package/dist/index.d.ts +10 -464
- package/dist/index.js +11 -8
- package/package.json +10 -10
package/dist/index.cjs
CHANGED
|
@@ -25627,7 +25627,7 @@ function newCachePolicy() {
|
|
|
25627
25627
|
};
|
|
25628
25628
|
}
|
|
25629
25629
|
|
|
25630
|
-
// ../../node_modules/inherits/inherits_browser.js
|
|
25630
|
+
// ../../node_modules/sha.js/node_modules/inherits/inherits_browser.js
|
|
25631
25631
|
var require_inherits_browser2 = __commonJS((exports2, module2) => {
|
|
25632
25632
|
if (typeof Object.create === "function") {
|
|
25633
25633
|
module2.exports = function inherits(ctor, superCtor) {
|
|
@@ -25657,7 +25657,7 @@ var require_inherits_browser2 = __commonJS((exports2, module2) => {
|
|
|
25657
25657
|
}
|
|
25658
25658
|
});
|
|
25659
25659
|
|
|
25660
|
-
// ../../node_modules/inherits/inherits.js
|
|
25660
|
+
// ../../node_modules/sha.js/node_modules/inherits/inherits.js
|
|
25661
25661
|
var require_inherits2 = __commonJS((exports2, module2) => {
|
|
25662
25662
|
try {
|
|
25663
25663
|
util = require("util");
|
|
@@ -45969,7 +45969,7 @@ var getPubsub = function() {
|
|
|
45969
45969
|
return pubsub;
|
|
45970
45970
|
};
|
|
45971
45971
|
|
|
45972
|
-
//
|
|
45972
|
+
// node_modules/@orion-js/helpers/dist/index.js
|
|
45973
45973
|
var import_node_module = require("node:module");
|
|
45974
45974
|
var __create2 = Object.create;
|
|
45975
45975
|
var __getProtoOf2 = Object.getPrototypeOf;
|
|
@@ -46699,7 +46699,7 @@ function getChannelName_default(name, params) {
|
|
|
46699
46699
|
return channelName;
|
|
46700
46700
|
}
|
|
46701
46701
|
|
|
46702
|
-
//
|
|
46702
|
+
// node_modules/@orion-js/resolvers/dist/index.js
|
|
46703
46703
|
var import_node_module2 = require("node:module");
|
|
46704
46704
|
var import_crypto = __toESM(require("crypto"));
|
|
46705
46705
|
var __create3 = Object.create;
|
|
@@ -53671,7 +53671,7 @@ var createSubscription = function(options) {
|
|
|
53671
53671
|
};
|
|
53672
53672
|
var subscription_default = createSubscription;
|
|
53673
53673
|
|
|
53674
|
-
//
|
|
53674
|
+
// node_modules/@orion-js/http/dist/index.js
|
|
53675
53675
|
var import_node_module3 = require("node:module");
|
|
53676
53676
|
var import_crypto2 = __toESM(require("crypto"));
|
|
53677
53677
|
var import_node_module4 = require("node:module");
|
|
@@ -91340,6 +91340,7 @@ function registerRoutes(routesMap) {
|
|
|
91340
91340
|
}
|
|
91341
91341
|
}
|
|
91342
91342
|
var import_body_parser = __toESM5(require_body_parser(), 1);
|
|
91343
|
+
var import_express3 = __toESM5(require_express2(), 1);
|
|
91343
91344
|
var __create42 = Object.create;
|
|
91344
91345
|
var __getProtoOf42 = Object.getPrototypeOf;
|
|
91345
91346
|
var __defProp42 = Object.defineProperty;
|
|
@@ -92634,6 +92635,8 @@ function getServiceRoutes(target) {
|
|
|
92634
92635
|
}
|
|
92635
92636
|
var bodyParser2 = { json: import_body_parser.json, raw: import_body_parser.raw, text: import_body_parser.text, urlencoded: import_body_parser.urlencoded };
|
|
92636
92637
|
var export_express = import_express2.default;
|
|
92638
|
+
var export_Response = import_express3.Response;
|
|
92639
|
+
var export_Request = import_express3.Request;
|
|
92637
92640
|
|
|
92638
92641
|
// src/startGraphiQL.ts
|
|
92639
92642
|
function safeSerialize(data) {
|
|
@@ -92844,7 +92847,7 @@ var import_isPlainObject11 = __toESM(require_isPlainObject2());
|
|
|
92844
92847
|
var import_isArray10 = __toESM(require_isArray4());
|
|
92845
92848
|
var import_graphql6 = __toESM(require_graphql2());
|
|
92846
92849
|
|
|
92847
|
-
//
|
|
92850
|
+
// node_modules/@orion-js/schema/dist/index.js
|
|
92848
92851
|
var __create7 = Object.create;
|
|
92849
92852
|
var __getProtoOf7 = Object.getPrototypeOf;
|
|
92850
92853
|
var __defProp7 = Object.defineProperty;
|
|
@@ -101465,7 +101468,7 @@ async function getBasicQuery(field) {
|
|
|
101465
101468
|
}
|
|
101466
101469
|
}
|
|
101467
101470
|
|
|
101468
|
-
//
|
|
101471
|
+
// node_modules/@orion-js/models/dist/index.js
|
|
101469
101472
|
var __create8 = Object.create;
|
|
101470
101473
|
var __getProtoOf8 = Object.getPrototypeOf;
|
|
101471
101474
|
var __defProp8 = Object.defineProperty;
|
|
@@ -106432,7 +106435,7 @@ class OrionSubscription {
|
|
|
106432
106435
|
returns;
|
|
106433
106436
|
publish;
|
|
106434
106437
|
}
|
|
106435
|
-
//
|
|
106438
|
+
// node_modules/@orion-js/services/dist/index.js
|
|
106436
106439
|
var __create9 = Object.create;
|
|
106437
106440
|
var __getProtoOf9 = Object.getPrototypeOf;
|
|
106438
106441
|
var __defProp9 = Object.defineProperty;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,87 +1,13 @@
|
|
|
1
1
|
// Generated by dts-bundle-generator v9.5.1
|
|
2
2
|
|
|
3
3
|
import { ApolloServerOptions } from '@apollo/server';
|
|
4
|
-
import express from '
|
|
4
|
+
import { express } from '@orion-js/http';
|
|
5
|
+
import { GlobalResolversMap, Model, ModelResolversMap } from '@orion-js/models';
|
|
6
|
+
import { GlobalResolverResolve, ModelResolver as ModelResolverType, ModelResolverResolve, Resolver, ResolverMiddleware, ResolverOptions } from '@orion-js/resolvers';
|
|
7
|
+
import { Schema } from '@orion-js/schema';
|
|
5
8
|
import * as GraphQL from 'graphql';
|
|
6
9
|
import { PubSubEngine } from 'graphql-subscriptions';
|
|
7
10
|
|
|
8
|
-
// Generated by dts-bundle-generator v9.5.1
|
|
9
|
-
// Generated by dts-bundle-generator v9.5.1
|
|
10
|
-
export interface StoredCacheData {
|
|
11
|
-
value: any;
|
|
12
|
-
expires?: Date;
|
|
13
|
-
}
|
|
14
|
-
export interface SetCacheOptions {
|
|
15
|
-
ttl?: number;
|
|
16
|
-
}
|
|
17
|
-
export interface GetCacheOptions {
|
|
18
|
-
ttl?: number;
|
|
19
|
-
fallback?(): Promise<any>;
|
|
20
|
-
}
|
|
21
|
-
export interface OrionCache {
|
|
22
|
-
/**
|
|
23
|
-
* Save data in the cache
|
|
24
|
-
*/
|
|
25
|
-
set(key: string, value: any, options?: SetCacheOptions): Promise<void> | void;
|
|
26
|
-
/**
|
|
27
|
-
* Get data from the cache
|
|
28
|
-
*/
|
|
29
|
-
get(key: string, options?: GetCacheOptions): Promise<StoredCacheData>;
|
|
30
|
-
/**
|
|
31
|
-
* Removes data from the cache
|
|
32
|
-
*/
|
|
33
|
-
invalidate(key: string): Promise<void> | void;
|
|
34
|
-
}
|
|
35
|
-
export type Blackbox = {
|
|
36
|
-
[name: string]: any;
|
|
37
|
-
};
|
|
38
|
-
export type GlobalResolverResolve = (params: any, viewer: any, info?: any) => Promise<any>;
|
|
39
|
-
export type ModelResolverResolve = (item: any, params: any, viewer: any, info?: any) => Promise<any>;
|
|
40
|
-
export type GlobalCheckPermissions = (params: any, viewer: any, info?: any) => Promise<string | void>;
|
|
41
|
-
export type ModelCheckPermissions = (parent: any, params: any, viewer: any, info?: any) => Promise<string | void>;
|
|
42
|
-
export type GlobalGetCacheKey = (params: any, viewer: any, info: any) => Promise<any>;
|
|
43
|
-
export type ModelGetCacheKey = (parent: any, params: any, viewer: any, info: any) => Promise<any>;
|
|
44
|
-
export interface ExecuteOptions {
|
|
45
|
-
params: Blackbox;
|
|
46
|
-
viewer: any;
|
|
47
|
-
parent?: any;
|
|
48
|
-
info?: any;
|
|
49
|
-
options: ResolverOptions;
|
|
50
|
-
}
|
|
51
|
-
export type Parameters$1<T> = T extends (...args: infer P) => any ? P : never;
|
|
52
|
-
export type ReturnType$1<T> = T extends (...args: any) => infer R ? R : any;
|
|
53
|
-
export type ResolverParams<Resolve, IsModel> = IsModel extends undefined ? Parameters$1<Resolve>[0] : Parameters$1<Resolve>[1];
|
|
54
|
-
export interface ExecuteParams<Resolve = Function, IsModel = undefined> {
|
|
55
|
-
params?: ResolverParams<Resolve, IsModel>;
|
|
56
|
-
viewer?: any;
|
|
57
|
-
parent?: IsModel extends undefined ? undefined : Parameters$1<Resolve>[0];
|
|
58
|
-
info?: any;
|
|
59
|
-
}
|
|
60
|
-
export type Execute<Resolve = Function, IsModel = undefined> = (executeOptions: ExecuteParams<Resolve, IsModel>) => ReturnType$1<Resolve>;
|
|
61
|
-
export interface SharedResolverOptions {
|
|
62
|
-
resolverId?: string;
|
|
63
|
-
params?: any;
|
|
64
|
-
returns?: any;
|
|
65
|
-
mutation?: boolean;
|
|
66
|
-
private?: boolean;
|
|
67
|
-
checkPermission?: GlobalCheckPermissions | ModelCheckPermissions;
|
|
68
|
-
getCacheKey?: GlobalGetCacheKey | ModelGetCacheKey;
|
|
69
|
-
cache?: number;
|
|
70
|
-
cacheProvider?: OrionCache;
|
|
71
|
-
permissionsOptions?: any;
|
|
72
|
-
middlewares?: ResolverMiddleware[];
|
|
73
|
-
}
|
|
74
|
-
export interface ResolverOptions<Resolve = Function> extends SharedResolverOptions {
|
|
75
|
-
resolve: Resolve;
|
|
76
|
-
}
|
|
77
|
-
export type OmitFirstArg<F> = F extends (x: any, ...args: infer P) => infer R ? (...args: P) => R : never;
|
|
78
|
-
export interface Resolver<Resolve = Function, IsModel = undefined> extends SharedResolverOptions {
|
|
79
|
-
execute: Execute<Resolve, IsModel>;
|
|
80
|
-
resolve: Resolve;
|
|
81
|
-
modelResolve: IsModel extends undefined ? undefined : OmitFirstArg<Resolve>;
|
|
82
|
-
}
|
|
83
|
-
export type ModelResolver<Resolve = Function> = Resolver<Resolve, true>;
|
|
84
|
-
export type ResolverMiddleware = (executeOptions: ExecuteOptions, next: () => Promise<any>) => Promise<any>;
|
|
85
11
|
export declare class OrionSubscription<TParams = any, ReturnType = any> {
|
|
86
12
|
name: string;
|
|
87
13
|
params: object;
|
|
@@ -97,262 +23,6 @@ export interface OrionSubscriptionOptions extends Omit<ResolverOptions, "resolve
|
|
|
97
23
|
name?: string;
|
|
98
24
|
}
|
|
99
25
|
declare const createSubscription: CreateOrionSubscriptionFunction;
|
|
100
|
-
interface StoredCacheData$1 {
|
|
101
|
-
value: any;
|
|
102
|
-
expires?: Date;
|
|
103
|
-
}
|
|
104
|
-
interface SetCacheOptions$1 {
|
|
105
|
-
ttl?: number;
|
|
106
|
-
}
|
|
107
|
-
interface GetCacheOptions$1 {
|
|
108
|
-
ttl?: number;
|
|
109
|
-
fallback?(): Promise<any>;
|
|
110
|
-
}
|
|
111
|
-
interface OrionCache$1 {
|
|
112
|
-
/**
|
|
113
|
-
* Save data in the cache
|
|
114
|
-
*/
|
|
115
|
-
set(key: string, value: any, options?: SetCacheOptions$1): Promise<void> | void;
|
|
116
|
-
/**
|
|
117
|
-
* Get data from the cache
|
|
118
|
-
*/
|
|
119
|
-
get(key: string, options?: GetCacheOptions$1): Promise<StoredCacheData$1>;
|
|
120
|
-
/**
|
|
121
|
-
* Removes data from the cache
|
|
122
|
-
*/
|
|
123
|
-
invalidate(key: string): Promise<void> | void;
|
|
124
|
-
}
|
|
125
|
-
type Blackbox$1 = {
|
|
126
|
-
[name: string]: any;
|
|
127
|
-
};
|
|
128
|
-
type GlobalResolverResolve$1 = (params: any, viewer: any, info?: any) => Promise<any>;
|
|
129
|
-
type ModelResolverResolve$1 = (item: any, params: any, viewer: any, info?: any) => Promise<any>;
|
|
130
|
-
type GlobalCheckPermissions$1 = (params: any, viewer: any, info?: any) => Promise<string | void>;
|
|
131
|
-
type ModelCheckPermissions$1 = (parent: any, params: any, viewer: any, info?: any) => Promise<string | void>;
|
|
132
|
-
type GlobalGetCacheKey$1 = (params: any, viewer: any, info: any) => Promise<any>;
|
|
133
|
-
type ModelGetCacheKey$1 = (parent: any, params: any, viewer: any, info: any) => Promise<any>;
|
|
134
|
-
interface ExecuteOptions$1 {
|
|
135
|
-
params: Blackbox$1;
|
|
136
|
-
viewer: any;
|
|
137
|
-
parent?: any;
|
|
138
|
-
info?: any;
|
|
139
|
-
options: ResolverOptions$1;
|
|
140
|
-
}
|
|
141
|
-
type Parameters$1$1<T> = T extends (...args: infer P) => any ? P : never;
|
|
142
|
-
type ReturnType$1$1<T> = T extends (...args: any) => infer R ? R : any;
|
|
143
|
-
type ResolverParams$1<Resolve, IsModel> = IsModel extends undefined ? Parameters$1$1<Resolve>[0] : Parameters$1$1<Resolve>[1];
|
|
144
|
-
interface ExecuteParams$1<Resolve = Function, IsModel = undefined> {
|
|
145
|
-
params?: ResolverParams$1<Resolve, IsModel>;
|
|
146
|
-
viewer?: any;
|
|
147
|
-
parent?: IsModel extends undefined ? undefined : Parameters$1$1<Resolve>[0];
|
|
148
|
-
info?: any;
|
|
149
|
-
}
|
|
150
|
-
type Execute$1<Resolve = Function, IsModel = undefined> = (executeOptions: ExecuteParams$1<Resolve, IsModel>) => ReturnType$1$1<Resolve>;
|
|
151
|
-
interface SharedResolverOptions$1 {
|
|
152
|
-
resolverId?: string;
|
|
153
|
-
params?: any;
|
|
154
|
-
returns?: any;
|
|
155
|
-
mutation?: boolean;
|
|
156
|
-
private?: boolean;
|
|
157
|
-
checkPermission?: GlobalCheckPermissions$1 | ModelCheckPermissions$1;
|
|
158
|
-
getCacheKey?: GlobalGetCacheKey$1 | ModelGetCacheKey$1;
|
|
159
|
-
cache?: number;
|
|
160
|
-
cacheProvider?: OrionCache$1;
|
|
161
|
-
permissionsOptions?: any;
|
|
162
|
-
middlewares?: ResolverMiddleware$1[];
|
|
163
|
-
}
|
|
164
|
-
interface ResolverOptions$1<Resolve = Function> extends SharedResolverOptions$1 {
|
|
165
|
-
resolve: Resolve;
|
|
166
|
-
}
|
|
167
|
-
type OmitFirstArg$1<F> = F extends (x: any, ...args: infer P) => infer R ? (...args: P) => R : never;
|
|
168
|
-
interface Resolver$1<Resolve = Function, IsModel = undefined> extends SharedResolverOptions$1 {
|
|
169
|
-
execute: Execute$1<Resolve, IsModel>;
|
|
170
|
-
resolve: Resolve;
|
|
171
|
-
modelResolve: IsModel extends undefined ? undefined : OmitFirstArg$1<Resolve>;
|
|
172
|
-
}
|
|
173
|
-
type ModelResolver$1<Resolve = Function> = Resolver$1<Resolve, true>;
|
|
174
|
-
type ResolverMiddleware$1 = (executeOptions: ExecuteOptions$1, next: () => Promise<any>) => Promise<any>;
|
|
175
|
-
export interface FieldType {
|
|
176
|
-
name: string;
|
|
177
|
-
validate: ValidateFunction;
|
|
178
|
-
clean: CleanFunction;
|
|
179
|
-
meta?: any;
|
|
180
|
-
toGraphQLType?: (GraphQL: any) => any;
|
|
181
|
-
_isFieldType: boolean;
|
|
182
|
-
}
|
|
183
|
-
export type Constructor<T> = new (...args: any[]) => T;
|
|
184
|
-
export type FieldTypesList = "string" | "date" | "integer" | "number" | "ID" | "boolean" | "email" | "blackbox" | "any";
|
|
185
|
-
export type TypedModelOnSchema = Function;
|
|
186
|
-
export type ConstructorsTypesList = Constructor<String> | Constructor<Number> | Constructor<Boolean> | Constructor<Date>;
|
|
187
|
-
export type SchemaRecursiveNodeTypeExtras = {
|
|
188
|
-
_isFieldType?: boolean;
|
|
189
|
-
__clean?: CleanFunction;
|
|
190
|
-
__validate?: ValidateFunction;
|
|
191
|
-
__skipChildValidation?: (value: any, info: CurrentNodeInfo) => Promise<boolean>;
|
|
192
|
-
};
|
|
193
|
-
export interface Schema {
|
|
194
|
-
[key: string]: SchemaNode | Function;
|
|
195
|
-
}
|
|
196
|
-
export type SchemaRecursiveNodeType = Schema & SchemaRecursiveNodeTypeExtras;
|
|
197
|
-
export type SchemaMetaFieldTypeSingle = FieldTypesList | ConstructorsTypesList | SchemaRecursiveNodeType | FieldType | TypedModelOnSchema;
|
|
198
|
-
export type SchemaMetaFieldType = SchemaMetaFieldTypeSingle | SchemaMetaFieldTypeSingle[];
|
|
199
|
-
export type ValidateFunction = (value: any, info?: Partial<CurrentNodeInfo>, ...args: any[]) => object | string | void | Promise<object | string | void>;
|
|
200
|
-
export type CleanFunction = (value: any, info?: Partial<CurrentNodeInfo>, ...args: any[]) => any | Promise<any>;
|
|
201
|
-
export interface SchemaNode {
|
|
202
|
-
/**
|
|
203
|
-
* The type of the field. Used for type validations. Can also contain a subschema.
|
|
204
|
-
*/
|
|
205
|
-
type: SchemaMetaFieldType;
|
|
206
|
-
/**
|
|
207
|
-
* Defaults to false
|
|
208
|
-
*/
|
|
209
|
-
optional?: boolean;
|
|
210
|
-
allowedValues?: Array<any>;
|
|
211
|
-
defaultValue?: ((info: CurrentNodeInfo, ...args: any[]) => any | Promise<any>) | any;
|
|
212
|
-
/**
|
|
213
|
-
* Function that takes a value and returns an error message if there are any errors. Must return null or undefined otherwise.
|
|
214
|
-
*/
|
|
215
|
-
validate?: ValidateFunction;
|
|
216
|
-
/**
|
|
217
|
-
* Function that preprocesses a value before it is set.
|
|
218
|
-
*/
|
|
219
|
-
clean?: CleanFunction;
|
|
220
|
-
autoValue?: (value: any, info: CurrentNodeInfo, ...args: any[]) => any | Promise<any>;
|
|
221
|
-
/**
|
|
222
|
-
* The minimum value if it's a number, the minimum length if it's a string or array.
|
|
223
|
-
*/
|
|
224
|
-
min?: number;
|
|
225
|
-
/**
|
|
226
|
-
* The maximum value if it's a number, the maximum length if it's a string or array.
|
|
227
|
-
*/
|
|
228
|
-
max?: number;
|
|
229
|
-
/**
|
|
230
|
-
* Internal use only.
|
|
231
|
-
*/
|
|
232
|
-
isBlackboxChild?: boolean;
|
|
233
|
-
/**
|
|
234
|
-
* @deprecated
|
|
235
|
-
*/
|
|
236
|
-
custom?: ValidateFunction;
|
|
237
|
-
/**
|
|
238
|
-
* Used in GraphQL. If true, the field will be omitted from the schema.
|
|
239
|
-
*/
|
|
240
|
-
private?: boolean;
|
|
241
|
-
/**
|
|
242
|
-
* Used in GraphQL. When in GraphQL, this resolver will replace the static field.
|
|
243
|
-
*/
|
|
244
|
-
graphQLResolver?: (...args: any) => any;
|
|
245
|
-
/**
|
|
246
|
-
* Used in GraphQL. Sets the key of the field in the GraphQL schema. You must set this value when building your schema.
|
|
247
|
-
*/
|
|
248
|
-
key?: string;
|
|
249
|
-
/**
|
|
250
|
-
* The name that would be displayed in a front-end form
|
|
251
|
-
*/
|
|
252
|
-
label?: string;
|
|
253
|
-
/**
|
|
254
|
-
* The description that would be displayed in a front-end form
|
|
255
|
-
*/
|
|
256
|
-
description?: string;
|
|
257
|
-
/**
|
|
258
|
-
* The placeholder that would be displayed in a front-end form
|
|
259
|
-
*/
|
|
260
|
-
placeholder?: string;
|
|
261
|
-
/**
|
|
262
|
-
* The field type that would be used in a front-end form
|
|
263
|
-
*/
|
|
264
|
-
fieldType?: string;
|
|
265
|
-
/**
|
|
266
|
-
* The field options that will be passed as props to the front-end field
|
|
267
|
-
*/
|
|
268
|
-
fieldOptions?: any;
|
|
269
|
-
}
|
|
270
|
-
export interface CurrentNodeInfoOptions {
|
|
271
|
-
autoConvert?: boolean;
|
|
272
|
-
filter?: boolean;
|
|
273
|
-
trimStrings?: boolean;
|
|
274
|
-
removeEmptyStrings?: boolean;
|
|
275
|
-
forceDoc?: any;
|
|
276
|
-
omitRequired?: boolean;
|
|
277
|
-
}
|
|
278
|
-
export interface CurrentNodeInfo {
|
|
279
|
-
/**
|
|
280
|
-
* The global schema, prefaced by {type: {...}} to be compatible with subschemas
|
|
281
|
-
* Sometimes it's given without {type: {...}}. TODO: Normalize this.
|
|
282
|
-
*/
|
|
283
|
-
schema?: SchemaNode | Schema;
|
|
284
|
-
/**
|
|
285
|
-
* The current node subschema
|
|
286
|
-
*/
|
|
287
|
-
currentSchema?: Partial<SchemaNode>;
|
|
288
|
-
value: any;
|
|
289
|
-
doc?: any;
|
|
290
|
-
currentDoc?: any;
|
|
291
|
-
options?: CurrentNodeInfoOptions;
|
|
292
|
-
args?: any[];
|
|
293
|
-
type?: SchemaMetaFieldType;
|
|
294
|
-
keys?: string[];
|
|
295
|
-
addError?: (keys: string[], code: string | object) => void;
|
|
296
|
-
}
|
|
297
|
-
export interface ModelResolversMap {
|
|
298
|
-
[key: string]: ModelResolver$1<ModelResolverResolve$1>;
|
|
299
|
-
}
|
|
300
|
-
export interface GlobalResolversMap {
|
|
301
|
-
[key: string]: Resolver$1<GlobalResolverResolve$1>;
|
|
302
|
-
}
|
|
303
|
-
export interface CloneOptions {
|
|
304
|
-
name: string;
|
|
305
|
-
omitFields?: string[];
|
|
306
|
-
pickFields?: string[];
|
|
307
|
-
mapFields?: (field: any, key: string) => any;
|
|
308
|
-
extendSchema?: Schema;
|
|
309
|
-
extendResolvers?: ModelResolversMap;
|
|
310
|
-
}
|
|
311
|
-
export interface Model<TSchema = any> {
|
|
312
|
-
__isModel: boolean;
|
|
313
|
-
/**
|
|
314
|
-
* The name of the model, used for example for GraphQL
|
|
315
|
-
*/
|
|
316
|
-
name: string;
|
|
317
|
-
/**
|
|
318
|
-
* Returns the schema of the model
|
|
319
|
-
*/
|
|
320
|
-
getSchema: () => Schema & {
|
|
321
|
-
__model: Model;
|
|
322
|
-
};
|
|
323
|
-
/**
|
|
324
|
-
* Returns the schema without adding __model to the schema
|
|
325
|
-
*/
|
|
326
|
-
getCleanSchema: () => Schema;
|
|
327
|
-
/**
|
|
328
|
-
* Returns the model resolvers
|
|
329
|
-
*/
|
|
330
|
-
getResolvers: () => ModelResolversMap;
|
|
331
|
-
/**
|
|
332
|
-
* Adds the model resolvers to a item
|
|
333
|
-
*/
|
|
334
|
-
initItem: (item: any) => any;
|
|
335
|
-
/**
|
|
336
|
-
* Validates an item using @orion-js/schema
|
|
337
|
-
*/
|
|
338
|
-
validate: (item: any) => Promise<any>;
|
|
339
|
-
/**
|
|
340
|
-
* Cleans an item using @orion-js/schema
|
|
341
|
-
*/
|
|
342
|
-
clean: (item: any) => Promise<TSchema>;
|
|
343
|
-
/**
|
|
344
|
-
* Cleans and validates an item using @orion-js/schema
|
|
345
|
-
*/
|
|
346
|
-
cleanAndValidate: (item: any) => Promise<TSchema>;
|
|
347
|
-
/**
|
|
348
|
-
* Creates a new model using this one as a base
|
|
349
|
-
*/
|
|
350
|
-
clone: (cloneOptions: CloneOptions) => Model;
|
|
351
|
-
/**
|
|
352
|
-
* The type of the model. Only use this in typescript
|
|
353
|
-
*/
|
|
354
|
-
type: TSchema;
|
|
355
|
-
}
|
|
356
26
|
export type ExecuteGraphQLCache = (req: express.Request, res: express.Response, viewer: object, executeQuery: () => Promise<string>) => Promise<string>;
|
|
357
27
|
export interface ModelsResolversMap {
|
|
358
28
|
[key: string]: ModelResolversMap;
|
|
@@ -391,135 +61,13 @@ export interface StartGraphQLOptions extends Omit<ApolloServerOptions<any>, Sche
|
|
|
391
61
|
declare function _default(options: StartGraphQLOptions): Promise<void>;
|
|
392
62
|
declare function _default$1(apolloOptions: ApolloServerOptions<any>, options: StartGraphQLOptions): void;
|
|
393
63
|
declare const _default$2: {
|
|
394
|
-
params: Resolver<({ mutation, name }: any, viewer: any) => Promise<{
|
|
395
|
-
resolver: Resolver
|
|
64
|
+
params: import("@orion-js/resolvers").Resolver<({ mutation, name }: any, viewer: any) => Promise<{
|
|
65
|
+
resolver: import("@orion-js/models").Resolver<import("@orion-js/models").GlobalResolverResolve, undefined>;
|
|
396
66
|
name: any;
|
|
397
67
|
}>, undefined>;
|
|
398
68
|
};
|
|
399
69
|
declare const _default$3: Model<any>;
|
|
400
|
-
|
|
401
|
-
name: string;
|
|
402
|
-
validate: ValidateFunction$1;
|
|
403
|
-
clean: CleanFunction$1;
|
|
404
|
-
meta?: any;
|
|
405
|
-
toGraphQLType?: (GraphQL: any) => any;
|
|
406
|
-
_isFieldType: boolean;
|
|
407
|
-
}
|
|
408
|
-
type Constructor$1<T> = new (...args: any[]) => T;
|
|
409
|
-
type FieldTypesList$1 = "string" | "date" | "integer" | "number" | "ID" | "boolean" | "email" | "blackbox" | "any";
|
|
410
|
-
type TypedModelOnSchema$1 = Function;
|
|
411
|
-
type ConstructorsTypesList$1 = Constructor$1<String> | Constructor$1<Number> | Constructor$1<Boolean> | Constructor$1<Date>;
|
|
412
|
-
type SchemaRecursiveNodeTypeExtras$1 = {
|
|
413
|
-
_isFieldType?: boolean;
|
|
414
|
-
__clean?: CleanFunction$1;
|
|
415
|
-
__validate?: ValidateFunction$1;
|
|
416
|
-
__skipChildValidation?: (value: any, info: CurrentNodeInfo$1) => Promise<boolean>;
|
|
417
|
-
};
|
|
418
|
-
interface Schema$1 {
|
|
419
|
-
[key: string]: SchemaNode$1 | Function;
|
|
420
|
-
}
|
|
421
|
-
type SchemaRecursiveNodeType$1 = Schema$1 & SchemaRecursiveNodeTypeExtras$1;
|
|
422
|
-
type SchemaMetaFieldTypeSingle$1 = FieldTypesList$1 | ConstructorsTypesList$1 | SchemaRecursiveNodeType$1 | FieldType$1 | TypedModelOnSchema$1;
|
|
423
|
-
type SchemaMetaFieldType$1 = SchemaMetaFieldTypeSingle$1 | SchemaMetaFieldTypeSingle$1[];
|
|
424
|
-
type ValidateFunction$1 = (value: any, info?: Partial<CurrentNodeInfo$1>, ...args: any[]) => object | string | void | Promise<object | string | void>;
|
|
425
|
-
type CleanFunction$1 = (value: any, info?: Partial<CurrentNodeInfo$1>, ...args: any[]) => any | Promise<any>;
|
|
426
|
-
interface SchemaNode$1 {
|
|
427
|
-
/**
|
|
428
|
-
* The type of the field. Used for type validations. Can also contain a subschema.
|
|
429
|
-
*/
|
|
430
|
-
type: SchemaMetaFieldType$1;
|
|
431
|
-
/**
|
|
432
|
-
* Defaults to false
|
|
433
|
-
*/
|
|
434
|
-
optional?: boolean;
|
|
435
|
-
allowedValues?: Array<any>;
|
|
436
|
-
defaultValue?: ((info: CurrentNodeInfo$1, ...args: any[]) => any | Promise<any>) | any;
|
|
437
|
-
/**
|
|
438
|
-
* Function that takes a value and returns an error message if there are any errors. Must return null or undefined otherwise.
|
|
439
|
-
*/
|
|
440
|
-
validate?: ValidateFunction$1;
|
|
441
|
-
/**
|
|
442
|
-
* Function that preprocesses a value before it is set.
|
|
443
|
-
*/
|
|
444
|
-
clean?: CleanFunction$1;
|
|
445
|
-
autoValue?: (value: any, info: CurrentNodeInfo$1, ...args: any[]) => any | Promise<any>;
|
|
446
|
-
/**
|
|
447
|
-
* The minimum value if it's a number, the minimum length if it's a string or array.
|
|
448
|
-
*/
|
|
449
|
-
min?: number;
|
|
450
|
-
/**
|
|
451
|
-
* The maximum value if it's a number, the maximum length if it's a string or array.
|
|
452
|
-
*/
|
|
453
|
-
max?: number;
|
|
454
|
-
/**
|
|
455
|
-
* Internal use only.
|
|
456
|
-
*/
|
|
457
|
-
isBlackboxChild?: boolean;
|
|
458
|
-
/**
|
|
459
|
-
* @deprecated
|
|
460
|
-
*/
|
|
461
|
-
custom?: ValidateFunction$1;
|
|
462
|
-
/**
|
|
463
|
-
* Used in GraphQL. If true, the field will be omitted from the schema.
|
|
464
|
-
*/
|
|
465
|
-
private?: boolean;
|
|
466
|
-
/**
|
|
467
|
-
* Used in GraphQL. When in GraphQL, this resolver will replace the static field.
|
|
468
|
-
*/
|
|
469
|
-
graphQLResolver?: (...args: any) => any;
|
|
470
|
-
/**
|
|
471
|
-
* Used in GraphQL. Sets the key of the field in the GraphQL schema. You must set this value when building your schema.
|
|
472
|
-
*/
|
|
473
|
-
key?: string;
|
|
474
|
-
/**
|
|
475
|
-
* The name that would be displayed in a front-end form
|
|
476
|
-
*/
|
|
477
|
-
label?: string;
|
|
478
|
-
/**
|
|
479
|
-
* The description that would be displayed in a front-end form
|
|
480
|
-
*/
|
|
481
|
-
description?: string;
|
|
482
|
-
/**
|
|
483
|
-
* The placeholder that would be displayed in a front-end form
|
|
484
|
-
*/
|
|
485
|
-
placeholder?: string;
|
|
486
|
-
/**
|
|
487
|
-
* The field type that would be used in a front-end form
|
|
488
|
-
*/
|
|
489
|
-
fieldType?: string;
|
|
490
|
-
/**
|
|
491
|
-
* The field options that will be passed as props to the front-end field
|
|
492
|
-
*/
|
|
493
|
-
fieldOptions?: any;
|
|
494
|
-
}
|
|
495
|
-
interface CurrentNodeInfoOptions$1 {
|
|
496
|
-
autoConvert?: boolean;
|
|
497
|
-
filter?: boolean;
|
|
498
|
-
trimStrings?: boolean;
|
|
499
|
-
removeEmptyStrings?: boolean;
|
|
500
|
-
forceDoc?: any;
|
|
501
|
-
omitRequired?: boolean;
|
|
502
|
-
}
|
|
503
|
-
interface CurrentNodeInfo$1 {
|
|
504
|
-
/**
|
|
505
|
-
* The global schema, prefaced by {type: {...}} to be compatible with subschemas
|
|
506
|
-
* Sometimes it's given without {type: {...}}. TODO: Normalize this.
|
|
507
|
-
*/
|
|
508
|
-
schema?: SchemaNode$1 | Schema$1;
|
|
509
|
-
/**
|
|
510
|
-
* The current node subschema
|
|
511
|
-
*/
|
|
512
|
-
currentSchema?: Partial<SchemaNode$1>;
|
|
513
|
-
value: any;
|
|
514
|
-
doc?: any;
|
|
515
|
-
currentDoc?: any;
|
|
516
|
-
options?: CurrentNodeInfoOptions$1;
|
|
517
|
-
args?: any[];
|
|
518
|
-
type?: SchemaMetaFieldType$1;
|
|
519
|
-
keys?: string[];
|
|
520
|
-
addError?: (keys: string[], code: string | object) => void;
|
|
521
|
-
}
|
|
522
|
-
export function serializeSchema(params: any): Promise<Schema$1>;
|
|
70
|
+
export function serializeSchema(params: any): Promise<Schema>;
|
|
523
71
|
declare function getBasicQuery(field: any): Promise<any>;
|
|
524
72
|
export declare function Resolvers(): ClassDecorator;
|
|
525
73
|
export interface GlobalResolverPropertyDescriptor extends Omit<PropertyDecorator, "value"> {
|
|
@@ -533,14 +81,14 @@ export declare function getServiceResolvers(target: any): {
|
|
|
533
81
|
export interface ModelResolverPropertyDescriptor extends Omit<PropertyDecorator, "value"> {
|
|
534
82
|
value?: ModelResolverResolve;
|
|
535
83
|
}
|
|
536
|
-
declare function ModelResolver
|
|
84
|
+
export declare function ModelResolver(options?: Omit<ResolverOptions<any>, "resolve" | "middlewares">): (target: any, propertyKey: string, descriptor: ModelResolverPropertyDescriptor) => void;
|
|
537
85
|
export interface ModelResolversOptions {
|
|
538
86
|
modelName?: string;
|
|
539
87
|
}
|
|
540
88
|
export declare function ModelResolvers(typedSchema: any, options?: ModelResolversOptions): ClassDecorator;
|
|
541
89
|
export declare function getServiceModelResolvers(target: any): {
|
|
542
90
|
[key: string]: {
|
|
543
|
-
[key: string]:
|
|
91
|
+
[key: string]: ModelResolverType<GlobalResolverResolve>;
|
|
544
92
|
};
|
|
545
93
|
};
|
|
546
94
|
export declare function Subscriptions(): ClassDecorator;
|
|
@@ -550,15 +98,13 @@ export declare function getServiceSubscriptions(target: any): {
|
|
|
550
98
|
};
|
|
551
99
|
export declare function getTargetMetadata(target: any, propertyKey: string, metadataKey: string): any;
|
|
552
100
|
export declare const UseMiddleware: (metadata: ResolverMiddleware) => (target: any, propertyKey: string, descriptor: GlobalResolverPropertyDescriptor | ModelResolverPropertyDescriptor) => void;
|
|
553
|
-
declare const ResolverParams
|
|
101
|
+
export declare const ResolverParams: (metadata: any) => (target: any, propertyKey: string, descriptor: GlobalResolverPropertyDescriptor | ModelResolverPropertyDescriptor) => void;
|
|
554
102
|
export declare const ResolverReturns: (metadata: any) => (target: any, propertyKey: string, descriptor: GlobalResolverPropertyDescriptor | ModelResolverPropertyDescriptor) => void;
|
|
555
103
|
export declare const getWebsockerViewer: (connectionParams: any) => Promise<any>;
|
|
556
104
|
export declare const setGetWebsockerViewer: (getViewerFunc: (connectionParams: any) => any) => void;
|
|
557
105
|
|
|
558
106
|
export {
|
|
559
107
|
GraphQL,
|
|
560
|
-
ModelResolver$2 as ModelResolver,
|
|
561
|
-
ResolverParams$2 as ResolverParams,
|
|
562
108
|
_default as startGraphQL,
|
|
563
109
|
_default$1 as startGraphiQL,
|
|
564
110
|
_default$2 as resolversSchemas,
|
package/dist/index.js
CHANGED
|
@@ -25614,7 +25614,7 @@ function newCachePolicy() {
|
|
|
25614
25614
|
};
|
|
25615
25615
|
}
|
|
25616
25616
|
|
|
25617
|
-
// ../../node_modules/inherits/inherits_browser.js
|
|
25617
|
+
// ../../node_modules/sha.js/node_modules/inherits/inherits_browser.js
|
|
25618
25618
|
var require_inherits_browser2 = __commonJS((exports2, module2) => {
|
|
25619
25619
|
if (typeof Object.create === "function") {
|
|
25620
25620
|
module2.exports = function inherits(ctor, superCtor) {
|
|
@@ -25644,7 +25644,7 @@ var require_inherits_browser2 = __commonJS((exports2, module2) => {
|
|
|
25644
25644
|
}
|
|
25645
25645
|
});
|
|
25646
25646
|
|
|
25647
|
-
// ../../node_modules/inherits/inherits.js
|
|
25647
|
+
// ../../node_modules/sha.js/node_modules/inherits/inherits.js
|
|
25648
25648
|
var require_inherits2 = __commonJS((exports2, module2) => {
|
|
25649
25649
|
try {
|
|
25650
25650
|
util = __require("util");
|
|
@@ -45915,7 +45915,7 @@ var getPubsub = function() {
|
|
|
45915
45915
|
return pubsub;
|
|
45916
45916
|
};
|
|
45917
45917
|
|
|
45918
|
-
//
|
|
45918
|
+
// node_modules/@orion-js/helpers/dist/index.js
|
|
45919
45919
|
import { createRequire as createRequire2 } from "node:module";
|
|
45920
45920
|
var __create2 = Object.create;
|
|
45921
45921
|
var __getProtoOf2 = Object.getPrototypeOf;
|
|
@@ -46645,7 +46645,7 @@ function getChannelName_default(name, params) {
|
|
|
46645
46645
|
return channelName;
|
|
46646
46646
|
}
|
|
46647
46647
|
|
|
46648
|
-
//
|
|
46648
|
+
// node_modules/@orion-js/resolvers/dist/index.js
|
|
46649
46649
|
import { createRequire as createRequire3 } from "node:module";
|
|
46650
46650
|
import crypto2 from "crypto";
|
|
46651
46651
|
var __create3 = Object.create;
|
|
@@ -53617,7 +53617,7 @@ var createSubscription = function(options) {
|
|
|
53617
53617
|
};
|
|
53618
53618
|
var subscription_default = createSubscription;
|
|
53619
53619
|
|
|
53620
|
-
//
|
|
53620
|
+
// node_modules/@orion-js/http/dist/index.js
|
|
53621
53621
|
import { createRequire as createRequire4 } from "node:module";
|
|
53622
53622
|
import crypto22 from "crypto";
|
|
53623
53623
|
import { createRequire as createRequire22 } from "node:module";
|
|
@@ -91286,6 +91286,7 @@ function registerRoutes(routesMap) {
|
|
|
91286
91286
|
}
|
|
91287
91287
|
}
|
|
91288
91288
|
var import_body_parser = __toESM5(require_body_parser(), 1);
|
|
91289
|
+
var import_express3 = __toESM5(require_express2(), 1);
|
|
91289
91290
|
var __create42 = Object.create;
|
|
91290
91291
|
var __getProtoOf42 = Object.getPrototypeOf;
|
|
91291
91292
|
var __defProp42 = Object.defineProperty;
|
|
@@ -92580,6 +92581,8 @@ function getServiceRoutes(target) {
|
|
|
92580
92581
|
}
|
|
92581
92582
|
var bodyParser2 = { json: import_body_parser.json, raw: import_body_parser.raw, text: import_body_parser.text, urlencoded: import_body_parser.urlencoded };
|
|
92582
92583
|
var export_express = import_express2.default;
|
|
92584
|
+
var export_Response = import_express3.Response;
|
|
92585
|
+
var export_Request = import_express3.Request;
|
|
92583
92586
|
|
|
92584
92587
|
// src/startGraphiQL.ts
|
|
92585
92588
|
function safeSerialize(data) {
|
|
@@ -92790,7 +92793,7 @@ var import_isPlainObject11 = __toESM(require_isPlainObject2(), 1);
|
|
|
92790
92793
|
var import_isArray10 = __toESM(require_isArray4(), 1);
|
|
92791
92794
|
var import_graphql6 = __toESM(require_graphql2(), 1);
|
|
92792
92795
|
|
|
92793
|
-
//
|
|
92796
|
+
// node_modules/@orion-js/schema/dist/index.js
|
|
92794
92797
|
var __create7 = Object.create;
|
|
92795
92798
|
var __getProtoOf7 = Object.getPrototypeOf;
|
|
92796
92799
|
var __defProp7 = Object.defineProperty;
|
|
@@ -101411,7 +101414,7 @@ async function getBasicQuery(field) {
|
|
|
101411
101414
|
}
|
|
101412
101415
|
}
|
|
101413
101416
|
|
|
101414
|
-
//
|
|
101417
|
+
// node_modules/@orion-js/models/dist/index.js
|
|
101415
101418
|
var __create8 = Object.create;
|
|
101416
101419
|
var __getProtoOf8 = Object.getPrototypeOf;
|
|
101417
101420
|
var __defProp8 = Object.defineProperty;
|
|
@@ -106378,7 +106381,7 @@ class OrionSubscription {
|
|
|
106378
106381
|
returns;
|
|
106379
106382
|
publish;
|
|
106380
106383
|
}
|
|
106381
|
-
//
|
|
106384
|
+
// node_modules/@orion-js/services/dist/index.js
|
|
106382
106385
|
var __create9 = Object.create;
|
|
106383
106386
|
var __getProtoOf9 = Object.getPrototypeOf;
|
|
106384
106387
|
var __defProp9 = Object.defineProperty;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orion-js/graphql",
|
|
3
|
-
"version": "4.0.0-
|
|
3
|
+
"version": "4.0.0-next.0",
|
|
4
4
|
"main": "./dist/index.cjs",
|
|
5
5
|
"author": "nicolaslopezj",
|
|
6
6
|
"license": "MIT",
|
|
@@ -16,14 +16,14 @@
|
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@apollo/server": "^4.3.0",
|
|
18
18
|
"@graphql-tools/schema": "^9.0.12",
|
|
19
|
-
"@orion-js/env": "
|
|
20
|
-
"@orion-js/helpers": "
|
|
21
|
-
"@orion-js/http": "
|
|
22
|
-
"@orion-js/models": "
|
|
23
|
-
"@orion-js/resolvers": "
|
|
24
|
-
"@orion-js/schema": "
|
|
25
|
-
"@orion-js/services": "
|
|
26
|
-
"@orion-js/typed-model": "
|
|
19
|
+
"@orion-js/env": "4.0.0-next.0",
|
|
20
|
+
"@orion-js/helpers": "4.0.0-next.0",
|
|
21
|
+
"@orion-js/http": "4.0.0-next.0",
|
|
22
|
+
"@orion-js/models": "4.0.0-next.0",
|
|
23
|
+
"@orion-js/resolvers": "4.0.0-next.0",
|
|
24
|
+
"@orion-js/schema": "4.0.0-next.0",
|
|
25
|
+
"@orion-js/services": "4.0.0-next.0",
|
|
26
|
+
"@orion-js/typed-model": "4.0.0-next.0",
|
|
27
27
|
"graphql-iso-date": "^3.6.1",
|
|
28
28
|
"graphql-subscriptions": "2.0.0",
|
|
29
29
|
"graphql-ws": "^5.11.2",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@types/bun": "^1.2.4"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"graphql": "
|
|
47
|
+
"graphql": "*"
|
|
48
48
|
},
|
|
49
49
|
"publishConfig": {
|
|
50
50
|
"access": "public"
|