@fluojs/graphql 1.0.0-beta.2 → 1.0.0-beta.4
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/README.ko.md +3 -1
- package/README.md +3 -1
- package/dist/decorators.d.ts +33 -1
- package/dist/decorators.d.ts.map +1 -1
- package/dist/decorators.js +43 -2
- package/dist/discovery.d.ts +7 -0
- package/dist/discovery.d.ts.map +1 -1
- package/dist/discovery.js +8 -1
- package/dist/metadata.d.ts +61 -0
- package/dist/metadata.d.ts.map +1 -1
- package/dist/metadata.js +74 -16
- package/dist/module.d.ts +3 -0
- package/dist/module.d.ts.map +1 -1
- package/dist/module.js +4 -0
- package/dist/schema/schema.d.ts +18 -0
- package/dist/schema/schema.d.ts.map +1 -1
- package/dist/schema/schema.js +20 -0
- package/dist/transport/transport.d.ts +19 -0
- package/dist/transport/transport.d.ts.map +1 -1
- package/dist/transport/transport.js +21 -0
- package/dist/types.d.ts +5 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/package.json +5 -5
package/README.ko.md
CHANGED
|
@@ -25,7 +25,7 @@ pnpm add @fluojs/graphql graphql graphql-yoga
|
|
|
25
25
|
## 사용 시점
|
|
26
26
|
|
|
27
27
|
- TypeScript 데코레이터를 사용하여 타입 안전한 GraphQL API를 구축할 때 (**Code-first**).
|
|
28
|
-
-
|
|
28
|
+
- 기존의 executable `GraphQLSchema` 객체를 fluo 애플리케이션에 통합할 때.
|
|
29
29
|
- GraphQL resolver 내에서 request-scoped provider를 포함한 원활한 의존성 주입이 필요할 때.
|
|
30
30
|
- Request-scoped **DataLoader** 패턴을 사용하여 효율적인 데이터 페칭을 수행할 때.
|
|
31
31
|
|
|
@@ -73,6 +73,8 @@ await app.listen(3000);
|
|
|
73
73
|
### Code-first Resolvers
|
|
74
74
|
fluo는 표준 데코레이터를 사용하여 GraphQL 스키마를 정의합니다. `@Resolver`, `@Query`, `@Mutation`, `@Subscription`을 사용하여 클래스 메서드를 GraphQL 작업에 매핑합니다. GraphQL 인자는 input DTO 필드에 `@Arg(...)`로 선언하고, resolver 메서드는 작업의 `input` 옵션을 통해 해당 DTO를 받습니다.
|
|
75
75
|
|
|
76
|
+
현재 `@fluojs/graphql` 런타임은 root operation resolver만 지원합니다. `author(book, context)` 같은 object field resolver 패턴은 아직 런타임 계약이 아니라 `packages/graphql/field-resolver-rfc.md`에 정리된 설계 초안입니다.
|
|
77
|
+
|
|
76
78
|
### Request-Scoped DataLoaders
|
|
77
79
|
내장된 DataLoader 통합을 통해 N+1 문제를 효율적으로 해결합니다. Loader는 각 GraphQL 작업마다 자동으로 격리됩니다.
|
|
78
80
|
|
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ pnpm add @fluojs/graphql graphql graphql-yoga
|
|
|
25
25
|
## When to Use
|
|
26
26
|
|
|
27
27
|
- When building type-safe GraphQL APIs using TypeScript decorators (**Code-first**).
|
|
28
|
-
- When integrating existing
|
|
28
|
+
- When integrating an existing executable `GraphQLSchema` object into a fluo application.
|
|
29
29
|
- When you need seamless dependency injection within GraphQL resolvers, including request-scoped providers.
|
|
30
30
|
- When performing efficient data fetching using request-scoped **DataLoader** patterns.
|
|
31
31
|
|
|
@@ -73,6 +73,8 @@ await app.listen(3000);
|
|
|
73
73
|
### Code-first Resolvers
|
|
74
74
|
fluo uses standard decorators to define your GraphQL schema. Use `@Resolver`, `@Query`, `@Mutation`, and `@Subscription` to map class methods to GraphQL operations. GraphQL arguments are declared on input DTO fields with `@Arg(...)`, then passed to the resolver method through the operation `input` option.
|
|
75
75
|
|
|
76
|
+
`@fluojs/graphql` currently supports root operation resolvers only. Object field-resolver patterns such as `author(book, context)` remain design-only and are documented in `packages/graphql/field-resolver-rfc.md`, not in the runtime contract.
|
|
77
|
+
|
|
76
78
|
### Request-Scoped DataLoaders
|
|
77
79
|
Efficiently solve the N+1 problem with built-in DataLoader integration. Loaders are automatically isolated per GraphQL operation.
|
|
78
80
|
|
package/dist/decorators.d.ts
CHANGED
|
@@ -2,20 +2,52 @@ import type { GraphqlArgType, GraphqlRootOutputType } from './types.js';
|
|
|
2
2
|
type StandardClassDecoratorFn = (value: Function, context: ClassDecoratorContext) => void;
|
|
3
3
|
type StandardMethodDecoratorFn = (value: Function, context: ClassMethodDecoratorContext) => void;
|
|
4
4
|
type StandardFieldDecoratorFn = <This, Value>(value: undefined, context: ClassFieldDecoratorContext<This, Value>) => void;
|
|
5
|
+
/**
|
|
6
|
+
* Describes the resolver method options contract.
|
|
7
|
+
*/
|
|
5
8
|
export interface ResolverMethodOptions {
|
|
6
9
|
fieldName?: string;
|
|
7
10
|
input?: Function;
|
|
8
|
-
topics?: string | string[];
|
|
9
11
|
argTypes?: Record<string, GraphqlArgType>;
|
|
10
12
|
outputType?: GraphqlRootOutputType;
|
|
11
13
|
}
|
|
12
14
|
type ClassDecoratorLike = StandardClassDecoratorFn;
|
|
13
15
|
type MethodDecoratorLike = StandardMethodDecoratorFn;
|
|
14
16
|
type FieldDecoratorLike = StandardFieldDecoratorFn;
|
|
17
|
+
/**
|
|
18
|
+
* Resolver.
|
|
19
|
+
*
|
|
20
|
+
* @param typeName The type name.
|
|
21
|
+
* @returns The resolver result.
|
|
22
|
+
*/
|
|
15
23
|
export declare function Resolver(typeName?: string): ClassDecoratorLike;
|
|
24
|
+
/**
|
|
25
|
+
* Query.
|
|
26
|
+
*
|
|
27
|
+
* @param fieldNameOrOptions The field name or options.
|
|
28
|
+
* @returns The query result.
|
|
29
|
+
*/
|
|
16
30
|
export declare function Query(fieldNameOrOptions?: string | ResolverMethodOptions): MethodDecoratorLike;
|
|
31
|
+
/**
|
|
32
|
+
* Mutation.
|
|
33
|
+
*
|
|
34
|
+
* @param fieldNameOrOptions The field name or options.
|
|
35
|
+
* @returns The mutation result.
|
|
36
|
+
*/
|
|
17
37
|
export declare function Mutation(fieldNameOrOptions?: string | ResolverMethodOptions): MethodDecoratorLike;
|
|
38
|
+
/**
|
|
39
|
+
* Subscription.
|
|
40
|
+
*
|
|
41
|
+
* @param fieldNameOrOptions The field name or options.
|
|
42
|
+
* @returns The subscription result.
|
|
43
|
+
*/
|
|
18
44
|
export declare function Subscription(fieldNameOrOptions?: string | ResolverMethodOptions): MethodDecoratorLike;
|
|
45
|
+
/**
|
|
46
|
+
* Arg.
|
|
47
|
+
*
|
|
48
|
+
* @param argName The arg name.
|
|
49
|
+
* @returns The arg result.
|
|
50
|
+
*/
|
|
19
51
|
export declare function Arg(argName?: string): FieldDecoratorLike;
|
|
20
52
|
export {};
|
|
21
53
|
//# sourceMappingURL=decorators.d.ts.map
|
package/dist/decorators.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAoB,cAAc,EAAE,qBAAqB,EAA6C,MAAM,YAAY,CAAC;AAGrI,KAAK,wBAAwB,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,qBAAqB,KAAK,IAAI,CAAC;AAC1F,KAAK,yBAAyB,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,2BAA2B,KAAK,IAAI,CAAC;AACjG,KAAK,wBAAwB,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,0BAA0B,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,IAAI,CAAC;AAE1H,MAAM,WAAW,qBAAqB;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,
|
|
1
|
+
{"version":3,"file":"decorators.d.ts","sourceRoot":"","sources":["../src/decorators.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAoB,cAAc,EAAE,qBAAqB,EAA6C,MAAM,YAAY,CAAC;AAGrI,KAAK,wBAAwB,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAA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handlerMetadataSymbol, resolverMetadataSymbol } from './metadata.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Describes the resolver method options contract.
|
|
6
|
+
*/
|
|
7
|
+
|
|
3
8
|
function getStandardMetadataBag(metadata) {
|
|
4
9
|
void metadataSymbol;
|
|
5
10
|
return metadata;
|
|
@@ -23,12 +28,14 @@ function normalizeMethodMetadata(type, fieldNameOrOptions) {
|
|
|
23
28
|
type
|
|
24
29
|
};
|
|
25
30
|
}
|
|
31
|
+
if ('topics' in fieldNameOrOptions) {
|
|
32
|
+
throw new Error('Resolver method option "topics" is not supported. GraphQL subscriptions must return an AsyncIterable directly until topic routing becomes a documented runtime feature.');
|
|
33
|
+
}
|
|
26
34
|
return {
|
|
27
35
|
argTypes: fieldNameOrOptions.argTypes,
|
|
28
36
|
fieldName: fieldNameOrOptions.fieldName?.trim() || undefined,
|
|
29
37
|
inputClass: fieldNameOrOptions.input,
|
|
30
38
|
outputType: fieldNameOrOptions.outputType,
|
|
31
|
-
topics: fieldNameOrOptions.topics,
|
|
32
39
|
type
|
|
33
40
|
};
|
|
34
41
|
}
|
|
@@ -47,7 +54,6 @@ function defineStandardHandlerMetadata(metadata, propertyKey, handlerMetadata) {
|
|
|
47
54
|
fieldName: handlerMetadata.fieldName,
|
|
48
55
|
inputClass: handlerMetadata.inputClass,
|
|
49
56
|
outputType: handlerMetadata.outputType,
|
|
50
|
-
topics: handlerMetadata.topics,
|
|
51
57
|
type: handlerMetadata.type
|
|
52
58
|
});
|
|
53
59
|
bag[handlerMetadataSymbol] = map;
|
|
@@ -76,6 +82,13 @@ function createMethodDecorator(type, fieldNameOrOptions) {
|
|
|
76
82
|
};
|
|
77
83
|
return decorator;
|
|
78
84
|
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Resolver.
|
|
88
|
+
*
|
|
89
|
+
* @param typeName The type name.
|
|
90
|
+
* @returns The resolver result.
|
|
91
|
+
*/
|
|
79
92
|
export function Resolver(typeName) {
|
|
80
93
|
const decorator = (value, context) => {
|
|
81
94
|
defineStandardResolverMetadata(context.metadata, {
|
|
@@ -84,15 +97,43 @@ export function Resolver(typeName) {
|
|
|
84
97
|
};
|
|
85
98
|
return decorator;
|
|
86
99
|
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Query.
|
|
103
|
+
*
|
|
104
|
+
* @param fieldNameOrOptions The field name or options.
|
|
105
|
+
* @returns The query result.
|
|
106
|
+
*/
|
|
87
107
|
export function Query(fieldNameOrOptions) {
|
|
88
108
|
return createMethodDecorator('query', fieldNameOrOptions);
|
|
89
109
|
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Mutation.
|
|
113
|
+
*
|
|
114
|
+
* @param fieldNameOrOptions The field name or options.
|
|
115
|
+
* @returns The mutation result.
|
|
116
|
+
*/
|
|
90
117
|
export function Mutation(fieldNameOrOptions) {
|
|
91
118
|
return createMethodDecorator('mutation', fieldNameOrOptions);
|
|
92
119
|
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Subscription.
|
|
123
|
+
*
|
|
124
|
+
* @param fieldNameOrOptions The field name or options.
|
|
125
|
+
* @returns The subscription result.
|
|
126
|
+
*/
|
|
93
127
|
export function Subscription(fieldNameOrOptions) {
|
|
94
128
|
return createMethodDecorator('subscription', fieldNameOrOptions);
|
|
95
129
|
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Arg.
|
|
133
|
+
*
|
|
134
|
+
* @param argName The arg name.
|
|
135
|
+
* @returns The arg result.
|
|
136
|
+
*/
|
|
96
137
|
export function Arg(argName) {
|
|
97
138
|
const decorator = (_value, context) => {
|
|
98
139
|
if (context.private) {
|
package/dist/discovery.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import type { CompiledModule } from '@fluojs/runtime';
|
|
2
2
|
import type { GraphqlModuleOptions, ResolverDescriptor } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Discover resolver descriptors.
|
|
5
|
+
*
|
|
6
|
+
* @param compiledModules The compiled modules.
|
|
7
|
+
* @param options The options.
|
|
8
|
+
* @returns The discover resolver descriptors result.
|
|
9
|
+
*/
|
|
3
10
|
export declare function discoverResolverDescriptors(compiledModules: readonly CompiledModule[], options: GraphqlModuleOptions): ResolverDescriptor[];
|
|
4
11
|
//# sourceMappingURL=discovery.d.ts.map
|
package/dist/discovery.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAkI3E,wBAAgB,2BAA2B,CACzC,eAAe,EAAE,SAAS,cAAc,EAAE,EAC1C,OAAO,EAAE,oBAAoB,GAC5B,kBAAkB,EAAE,
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot":"","sources":["../src/discovery.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGtD,OAAO,KAAK,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAkI3E;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CACzC,eAAe,EAAE,SAAS,cAAc,EAAE,EAC1C,OAAO,EAAE,oBAAoB,GAC5B,kBAAkB,EAAE,CA8CtB"}
|
package/dist/discovery.js
CHANGED
|
@@ -99,6 +99,14 @@ function discoveryCandidates(compiledModules) {
|
|
|
99
99
|
}
|
|
100
100
|
return candidates;
|
|
101
101
|
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Discover resolver descriptors.
|
|
105
|
+
*
|
|
106
|
+
* @param compiledModules The compiled modules.
|
|
107
|
+
* @param options The options.
|
|
108
|
+
* @returns The discover resolver descriptors result.
|
|
109
|
+
*/
|
|
102
110
|
export function discoverResolverDescriptors(compiledModules, options) {
|
|
103
111
|
const allowedResolvers = normalizeAllowedResolverSet(options.resolvers);
|
|
104
112
|
const seenTargets = new Set();
|
|
@@ -127,7 +135,6 @@ export function discoverResolverDescriptors(compiledModules, options) {
|
|
|
127
135
|
methodKey: entry.propertyKey,
|
|
128
136
|
methodName: methodKeyToName(entry.propertyKey),
|
|
129
137
|
outputType: entry.metadata.outputType,
|
|
130
|
-
topics: entry.metadata.topics,
|
|
131
138
|
type: entry.metadata.type
|
|
132
139
|
};
|
|
133
140
|
}),
|
package/dist/metadata.d.ts
CHANGED
|
@@ -1,20 +1,81 @@
|
|
|
1
1
|
import type { MetadataPropertyKey } from '@fluojs/core';
|
|
2
2
|
import type { ArgFieldMetadata, ResolverHandlerMetadata, ResolverMetadata } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Define resolver metadata.
|
|
5
|
+
*
|
|
6
|
+
* @param target The target.
|
|
7
|
+
* @param metadata The metadata.
|
|
8
|
+
*/
|
|
3
9
|
export declare function defineResolverMetadata(target: object, metadata: ResolverMetadata): void;
|
|
10
|
+
/**
|
|
11
|
+
* Get resolver metadata.
|
|
12
|
+
*
|
|
13
|
+
* @param target The target.
|
|
14
|
+
* @returns The get resolver metadata result.
|
|
15
|
+
*/
|
|
4
16
|
export declare function getResolverMetadata(target: object): ResolverMetadata | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Define resolver handler metadata.
|
|
19
|
+
*
|
|
20
|
+
* @param target The target.
|
|
21
|
+
* @param propertyKey The property key.
|
|
22
|
+
* @param metadata The metadata.
|
|
23
|
+
*/
|
|
5
24
|
export declare function defineResolverHandlerMetadata(target: object, propertyKey: MetadataPropertyKey, metadata: ResolverHandlerMetadata): void;
|
|
25
|
+
/**
|
|
26
|
+
* Get resolver handler metadata.
|
|
27
|
+
*
|
|
28
|
+
* @param target The target.
|
|
29
|
+
* @param propertyKey The property key.
|
|
30
|
+
* @returns The get resolver handler metadata result.
|
|
31
|
+
*/
|
|
6
32
|
export declare function getResolverHandlerMetadata(target: object, propertyKey: MetadataPropertyKey): ResolverHandlerMetadata | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Get resolver handler metadata entries.
|
|
35
|
+
*
|
|
36
|
+
* @param target The target.
|
|
37
|
+
* @returns The get resolver handler metadata entries result.
|
|
38
|
+
*/
|
|
7
39
|
export declare function getResolverHandlerMetadataEntries(target: object): Array<{
|
|
8
40
|
metadata: ResolverHandlerMetadata;
|
|
9
41
|
propertyKey: MetadataPropertyKey;
|
|
10
42
|
}>;
|
|
43
|
+
/**
|
|
44
|
+
* Define arg field metadata.
|
|
45
|
+
*
|
|
46
|
+
* @param target The target.
|
|
47
|
+
* @param propertyKey The property key.
|
|
48
|
+
* @param metadata The metadata.
|
|
49
|
+
*/
|
|
11
50
|
export declare function defineArgFieldMetadata(target: object, propertyKey: MetadataPropertyKey, metadata: ArgFieldMetadata): void;
|
|
51
|
+
/**
|
|
52
|
+
* Get arg field metadata.
|
|
53
|
+
*
|
|
54
|
+
* @param target The target.
|
|
55
|
+
* @param propertyKey The property key.
|
|
56
|
+
* @returns The get arg field metadata result.
|
|
57
|
+
*/
|
|
12
58
|
export declare function getArgFieldMetadata(target: object, propertyKey: MetadataPropertyKey): ArgFieldMetadata | undefined;
|
|
59
|
+
/**
|
|
60
|
+
* Get arg field metadata entries.
|
|
61
|
+
*
|
|
62
|
+
* @param target The target.
|
|
63
|
+
* @returns The get arg field metadata entries result.
|
|
64
|
+
*/
|
|
13
65
|
export declare function getArgFieldMetadataEntries(target: object): Array<{
|
|
14
66
|
metadata: ArgFieldMetadata;
|
|
15
67
|
propertyKey: MetadataPropertyKey;
|
|
16
68
|
}>;
|
|
69
|
+
/**
|
|
70
|
+
* Provides the resolver metadata symbol value.
|
|
71
|
+
*/
|
|
17
72
|
export declare const resolverMetadataSymbol: symbol;
|
|
73
|
+
/**
|
|
74
|
+
* Provides the handler metadata symbol value.
|
|
75
|
+
*/
|
|
18
76
|
export declare const handlerMetadataSymbol: symbol;
|
|
77
|
+
/**
|
|
78
|
+
* Provides the arg metadata symbol value.
|
|
79
|
+
*/
|
|
19
80
|
export declare const argMetadataSymbol: symbol;
|
|
20
81
|
//# sourceMappingURL=metadata.d.ts.map
|
package/dist/metadata.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../src/metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../src/metadata.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAGxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAoG9F;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAEvF;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,GAAG,SAAS,CAShF;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,mBAAmB,EAChC,QAAQ,EAAE,uBAAuB,GAChC,IAAI,CAEN;AAED;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,mBAAmB,GAC/B,uBAAuB,GAAG,SAAS,CASrC;AAED;;;;;GAKG;AACH,wBAAgB,iCAAiC,CAC/C,MAAM,EAAE,MAAM,GACb,KAAK,CAAC;IAAE,QAAQ,EAAE,uBAAuB,CAAC;IAAC,WAAW,EAAE,mBAAmB,CAAA;CAAE,CAAC,CAOhF;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,mBAAmB,EAAE,QAAQ,EAAE,gBAAgB,GAAG,IAAI,CAEzH;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,mBAAmB,GAAG,gBAAgB,GAAG,SAAS,CASlH;AAED;;;;;GAKG;AACH,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,MAAM,GACb,KAAK,CAAC;IAAE,QAAQ,EAAE,gBAAgB,CAAC;IAAC,WAAW,EAAE,mBAAmB,CAAA;CAAE,CAAC,CAEzE;AAED;;GAEG;AACH,eAAO,MAAM,sBAAsB,QAA8B,CAAC;AAClE;;GAEG;AACH,eAAO,MAAM,qBAAqB,QAA6B,CAAC;AAChE;;GAEG;AACH,eAAO,MAAM,iBAAiB,QAA8B,CAAC"}
|
package/dist/metadata.js
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
if (!symbolWithMetadata.metadata) {
|
|
4
|
-
Object.defineProperty(Symbol, 'metadata', {
|
|
5
|
-
configurable: true,
|
|
6
|
-
value: metadataSymbol
|
|
7
|
-
});
|
|
8
|
-
}
|
|
1
|
+
import { ensureSymbolMetadataPolyfill, getStandardConstructorMetadataBag, getStandardMetadataBag } from '@fluojs/core/internal';
|
|
2
|
+
void ensureSymbolMetadataPolyfill();
|
|
9
3
|
const standardResolverMetadataKey = Symbol.for('fluo.graphql.standard.resolver');
|
|
10
4
|
const standardHandlerMetadataKey = Symbol.for('fluo.graphql.standard.handler');
|
|
11
5
|
const standardArgFieldMetadataKey = Symbol.for('fluo.graphql.standard.arg-field');
|
|
@@ -23,7 +17,6 @@ function cloneHandlerMetadata(metadata) {
|
|
|
23
17
|
fieldName: metadata.fieldName,
|
|
24
18
|
inputClass: metadata.inputClass,
|
|
25
19
|
outputType: metadata.outputType,
|
|
26
|
-
topics: metadata.topics,
|
|
27
20
|
type: metadata.type
|
|
28
21
|
};
|
|
29
22
|
}
|
|
@@ -33,9 +26,6 @@ function cloneArgFieldMetadata(metadata) {
|
|
|
33
26
|
fieldName: metadata.fieldName
|
|
34
27
|
};
|
|
35
28
|
}
|
|
36
|
-
function getStandardMetadataBag(target) {
|
|
37
|
-
return target[metadataSymbol];
|
|
38
|
-
}
|
|
39
29
|
function getStandardResolverMetadata(target) {
|
|
40
30
|
const metadata = getStandardMetadataBag(target)?.[standardResolverMetadataKey];
|
|
41
31
|
if (!metadata) {
|
|
@@ -44,12 +34,10 @@ function getStandardResolverMetadata(target) {
|
|
|
44
34
|
return cloneResolverMetadata(metadata);
|
|
45
35
|
}
|
|
46
36
|
function getStandardHandlerMap(target) {
|
|
47
|
-
|
|
48
|
-
return constructor ? getStandardMetadataBag(constructor)?.[standardHandlerMetadataKey] : undefined;
|
|
37
|
+
return getStandardConstructorMetadataBag(target)?.[standardHandlerMetadataKey];
|
|
49
38
|
}
|
|
50
39
|
function getStandardArgFieldMap(target) {
|
|
51
|
-
|
|
52
|
-
return constructor ? getStandardMetadataBag(constructor)?.[standardArgFieldMetadataKey] : undefined;
|
|
40
|
+
return getStandardConstructorMetadataBag(target)?.[standardArgFieldMetadataKey];
|
|
53
41
|
}
|
|
54
42
|
function getOrCreateHandlerMetadataMap(target) {
|
|
55
43
|
let map = handlerMetadataStore.get(target);
|
|
@@ -76,9 +64,23 @@ function getMergedMetadataEntries(target, stored, standard, resolve) {
|
|
|
76
64
|
propertyKey
|
|
77
65
|
})).filter(entry => entry.metadata !== undefined);
|
|
78
66
|
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Define resolver metadata.
|
|
70
|
+
*
|
|
71
|
+
* @param target The target.
|
|
72
|
+
* @param metadata The metadata.
|
|
73
|
+
*/
|
|
79
74
|
export function defineResolverMetadata(target, metadata) {
|
|
80
75
|
resolverMetadataStore.set(target, cloneResolverMetadata(metadata));
|
|
81
76
|
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* Get resolver metadata.
|
|
80
|
+
*
|
|
81
|
+
* @param target The target.
|
|
82
|
+
* @returns The get resolver metadata result.
|
|
83
|
+
*/
|
|
82
84
|
export function getResolverMetadata(target) {
|
|
83
85
|
const stored = resolverMetadataStore.get(target);
|
|
84
86
|
const standard = getStandardResolverMetadata(target);
|
|
@@ -87,9 +89,25 @@ export function getResolverMetadata(target) {
|
|
|
87
89
|
}
|
|
88
90
|
return cloneResolverMetadata(stored ?? standard);
|
|
89
91
|
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Define resolver handler metadata.
|
|
95
|
+
*
|
|
96
|
+
* @param target The target.
|
|
97
|
+
* @param propertyKey The property key.
|
|
98
|
+
* @param metadata The metadata.
|
|
99
|
+
*/
|
|
90
100
|
export function defineResolverHandlerMetadata(target, propertyKey, metadata) {
|
|
91
101
|
getOrCreateHandlerMetadataMap(target).set(propertyKey, cloneHandlerMetadata(metadata));
|
|
92
102
|
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Get resolver handler metadata.
|
|
106
|
+
*
|
|
107
|
+
* @param target The target.
|
|
108
|
+
* @param propertyKey The property key.
|
|
109
|
+
* @returns The get resolver handler metadata result.
|
|
110
|
+
*/
|
|
93
111
|
export function getResolverHandlerMetadata(target, propertyKey) {
|
|
94
112
|
const stored = handlerMetadataStore.get(target)?.get(propertyKey);
|
|
95
113
|
const standard = getStandardHandlerMap(target)?.get(propertyKey);
|
|
@@ -98,12 +116,35 @@ export function getResolverHandlerMetadata(target, propertyKey) {
|
|
|
98
116
|
}
|
|
99
117
|
return cloneHandlerMetadata(stored ?? standard);
|
|
100
118
|
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* Get resolver handler metadata entries.
|
|
122
|
+
*
|
|
123
|
+
* @param target The target.
|
|
124
|
+
* @returns The get resolver handler metadata entries result.
|
|
125
|
+
*/
|
|
101
126
|
export function getResolverHandlerMetadataEntries(target) {
|
|
102
127
|
return getMergedMetadataEntries(target, handlerMetadataStore.get(target), getStandardHandlerMap(target), getResolverHandlerMetadata);
|
|
103
128
|
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Define arg field metadata.
|
|
132
|
+
*
|
|
133
|
+
* @param target The target.
|
|
134
|
+
* @param propertyKey The property key.
|
|
135
|
+
* @param metadata The metadata.
|
|
136
|
+
*/
|
|
104
137
|
export function defineArgFieldMetadata(target, propertyKey, metadata) {
|
|
105
138
|
getOrCreateArgFieldMetadataMap(target).set(propertyKey, cloneArgFieldMetadata(metadata));
|
|
106
139
|
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Get arg field metadata.
|
|
143
|
+
*
|
|
144
|
+
* @param target The target.
|
|
145
|
+
* @param propertyKey The property key.
|
|
146
|
+
* @returns The get arg field metadata result.
|
|
147
|
+
*/
|
|
107
148
|
export function getArgFieldMetadata(target, propertyKey) {
|
|
108
149
|
const stored = argFieldMetadataStore.get(target)?.get(propertyKey);
|
|
109
150
|
const standard = getStandardArgFieldMap(target)?.get(propertyKey);
|
|
@@ -112,9 +153,26 @@ export function getArgFieldMetadata(target, propertyKey) {
|
|
|
112
153
|
}
|
|
113
154
|
return cloneArgFieldMetadata(stored ?? standard);
|
|
114
155
|
}
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Get arg field metadata entries.
|
|
159
|
+
*
|
|
160
|
+
* @param target The target.
|
|
161
|
+
* @returns The get arg field metadata entries result.
|
|
162
|
+
*/
|
|
115
163
|
export function getArgFieldMetadataEntries(target) {
|
|
116
164
|
return getMergedMetadataEntries(target, argFieldMetadataStore.get(target), getStandardArgFieldMap(target), getArgFieldMetadata);
|
|
117
165
|
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Provides the resolver metadata symbol value.
|
|
169
|
+
*/
|
|
118
170
|
export const resolverMetadataSymbol = standardResolverMetadataKey;
|
|
171
|
+
/**
|
|
172
|
+
* Provides the handler metadata symbol value.
|
|
173
|
+
*/
|
|
119
174
|
export const handlerMetadataSymbol = standardHandlerMetadataKey;
|
|
175
|
+
/**
|
|
176
|
+
* Provides the arg metadata symbol value.
|
|
177
|
+
*/
|
|
120
178
|
export const argMetadataSymbol = standardArgFieldMetadataKey;
|
package/dist/module.d.ts
CHANGED
|
@@ -9,6 +9,9 @@ import type { GraphqlModuleOptions } from './types.js';
|
|
|
9
9
|
* does not register `GraphqlEndpointController` or mount the `/graphql` endpoint by itself.
|
|
10
10
|
*/
|
|
11
11
|
export declare function createGraphqlProviders(options: GraphqlModuleOptions): Provider[];
|
|
12
|
+
/**
|
|
13
|
+
* Represents the graphql module.
|
|
14
|
+
*/
|
|
12
15
|
export declare class GraphqlModule {
|
|
13
16
|
/**
|
|
14
17
|
* Registers the GraphQL endpoint controller together with lifecycle providers.
|
package/dist/module.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAIhE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,oBAAoB,GAAG,QAAQ,EAAE,CAQhF;AAED,qBAAa,aAAa;IACxB;;;;;;OAMG;IACH,MAAM,CAAC,OAAO,CAAC,OAAO,GAAE,oBAAyB,GAAG,UAAU;CAS/D"}
|
|
1
|
+
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../src/module.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAIhE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,oBAAoB,GAAG,QAAQ,EAAE,CAQhF;AAED;;GAEG;AACH,qBAAa,aAAa;IACxB;;;;;;OAMG;IACH,MAAM,CAAC,OAAO,CAAC,OAAO,GAAE,oBAAyB,GAAG,UAAU;CAS/D"}
|
package/dist/module.js
CHANGED
|
@@ -14,6 +14,10 @@ export function createGraphqlProviders(options) {
|
|
|
14
14
|
useValue: options
|
|
15
15
|
}, GraphqlLifecycleService];
|
|
16
16
|
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Represents the graphql module.
|
|
20
|
+
*/
|
|
17
21
|
export class GraphqlModule {
|
|
18
22
|
/**
|
|
19
23
|
* Registers the GraphQL endpoint controller together with lifecycle providers.
|
package/dist/schema/schema.d.ts
CHANGED
|
@@ -14,7 +14,25 @@ type YogaGraphqlDeps = {
|
|
|
14
14
|
GraphQLUnionType: typeof GraphQLUnionTypeType;
|
|
15
15
|
buildSchema: (source: string) => GraphQLSchemaType;
|
|
16
16
|
};
|
|
17
|
+
/**
|
|
18
|
+
* Resolve schema.
|
|
19
|
+
*
|
|
20
|
+
* @param deps The deps.
|
|
21
|
+
* @param optionsSchema The options schema.
|
|
22
|
+
* @param createCodeFirstSchema The create code first schema.
|
|
23
|
+
* @param markAllowedCrossRealmGraphqlObjects The mark allowed cross realm graphql objects.
|
|
24
|
+
* @returns The resolve schema result.
|
|
25
|
+
*/
|
|
17
26
|
export declare function resolveSchema(deps: YogaGraphqlDeps, optionsSchema: GraphQLSchemaType | string | undefined, createCodeFirstSchema: () => GraphQLSchemaType, markAllowedCrossRealmGraphqlObjects: (value: unknown) => void): GraphQLSchemaType;
|
|
27
|
+
/**
|
|
28
|
+
* Create code first schema.
|
|
29
|
+
*
|
|
30
|
+
* @param deps The deps.
|
|
31
|
+
* @param runtimeContainer The runtime container.
|
|
32
|
+
* @param resolverDescriptors The resolver descriptors.
|
|
33
|
+
* @param markAllowedCrossRealmGraphqlObjects The mark allowed cross realm graphql objects.
|
|
34
|
+
* @returns The create code first schema result.
|
|
35
|
+
*/
|
|
18
36
|
export declare function createCodeFirstSchema(deps: YogaGraphqlDeps, runtimeContainer: Container, resolverDescriptors: ResolverDescriptor[], markAllowedCrossRealmGraphqlObjects?: (value: unknown) => void): GraphQLSchemaType;
|
|
19
37
|
export {};
|
|
20
38
|
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/schema/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,KAAK,EAGV,YAAY,IAAI,gBAAgB,EAGhC,WAAW,IAAI,eAAe,EAC9B,iBAAiB,IAAI,qBAAqB,EAE1C,aAAa,IAAI,iBAAiB,EAClC,iBAAiB,EACjB,gBAAgB,IAAI,oBAAoB,EACzC,MAAM,SAAS,CAAC;AAIjB,OAAO,EAOL,KAAK,kBAAkB,EAGxB,MAAM,aAAa,CAAC;AAErB,KAAK,eAAe,GAAG;IACrB,YAAY,EAAE,OAAO,gBAAgB,CAAC;IACtC,cAAc,EAAE,iBAAiB,CAAC;IAClC,YAAY,EAAE,iBAAiB,CAAC;IAChC,SAAS,EAAE,iBAAiB,CAAC;IAC7B,UAAU,EAAE,iBAAiB,CAAC;IAC9B,WAAW,EAAE,OAAO,eAAe,CAAC;IACpC,iBAAiB,EAAE,OAAO,qBAAqB,CAAC;IAChD,aAAa,EAAE,OAAO,iBAAiB,CAAC;IACxC,aAAa,EAAE,iBAAiB,CAAC;IACjC,gBAAgB,EAAE,OAAO,oBAAoB,CAAC;IAC9C,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,iBAAiB,CAAC;CACpD,CAAC;AAiaF,wBAAgB,aAAa,CAC3B,IAAI,EAAE,eAAe,EACrB,aAAa,EAAE,iBAAiB,GAAG,MAAM,GAAG,SAAS,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EAAE,iBAAiB,GAAG,MAAM,GAAG,SAAS,EACrD,qBAAqB,EAAE,MAAM,iBAAiB,EAC9C,mCAAmC,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAC5D,iBAAiB,CAWnB;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,eAAe,EACrB,gBAAgB,EAAE,SAAS,EAC3B,mBAAmB,EAAE,kBAAkB,EAAE,EACzC,mCAAmC,GAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAe,GACvE,iBAAiB,CA0CnB"}
|
package/dist/schema/schema.js
CHANGED
|
@@ -248,6 +248,16 @@ function createOptionalRootType(deps, name, fields) {
|
|
|
248
248
|
name
|
|
249
249
|
});
|
|
250
250
|
}
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Resolve schema.
|
|
254
|
+
*
|
|
255
|
+
* @param deps The deps.
|
|
256
|
+
* @param optionsSchema The options schema.
|
|
257
|
+
* @param createCodeFirstSchema The create code first schema.
|
|
258
|
+
* @param markAllowedCrossRealmGraphqlObjects The mark allowed cross realm graphql objects.
|
|
259
|
+
* @returns The resolve schema result.
|
|
260
|
+
*/
|
|
251
261
|
export function resolveSchema(deps, optionsSchema, createCodeFirstSchema, markAllowedCrossRealmGraphqlObjects) {
|
|
252
262
|
if (isGraphQLSchemaLike(optionsSchema)) {
|
|
253
263
|
markAllowedCrossRealmGraphqlObjects(optionsSchema);
|
|
@@ -258,6 +268,16 @@ export function resolveSchema(deps, optionsSchema, createCodeFirstSchema, markAl
|
|
|
258
268
|
}
|
|
259
269
|
return createCodeFirstSchema();
|
|
260
270
|
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Create code first schema.
|
|
274
|
+
*
|
|
275
|
+
* @param deps The deps.
|
|
276
|
+
* @param runtimeContainer The runtime container.
|
|
277
|
+
* @param resolverDescriptors The resolver descriptors.
|
|
278
|
+
* @param markAllowedCrossRealmGraphqlObjects The mark allowed cross realm graphql objects.
|
|
279
|
+
* @returns The create code first schema result.
|
|
280
|
+
*/
|
|
261
281
|
export function createCodeFirstSchema(deps, runtimeContainer, resolverDescriptors, markAllowedCrossRealmGraphqlObjects = () => {}) {
|
|
262
282
|
if (resolverDescriptors.length === 0) {
|
|
263
283
|
throw new Error('GraphQL module requires either schema or at least one resolver decorated with @Resolver().');
|
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
import type { FrameworkRequest, FrameworkResponse } from '@fluojs/http';
|
|
2
|
+
/**
|
|
3
|
+
* Is graphql path.
|
|
4
|
+
*
|
|
5
|
+
* @param path The path.
|
|
6
|
+
* @returns The is graphql path result.
|
|
7
|
+
*/
|
|
2
8
|
export declare function isGraphqlPath(path: string): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* To fetch request.
|
|
11
|
+
*
|
|
12
|
+
* @param request The request.
|
|
13
|
+
* @returns The to fetch request result.
|
|
14
|
+
*/
|
|
3
15
|
export declare function toFetchRequest(request: FrameworkRequest): Request;
|
|
16
|
+
/**
|
|
17
|
+
* Write fetch response.
|
|
18
|
+
*
|
|
19
|
+
* @param fetchResponse The fetch response.
|
|
20
|
+
* @param frameworkResponse The framework response.
|
|
21
|
+
* @returns The write fetch response result.
|
|
22
|
+
*/
|
|
4
23
|
export declare function writeFetchResponse(fetchResponse: Response, frameworkResponse: FrameworkResponse): Promise<void>;
|
|
5
24
|
//# sourceMappingURL=transport.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/transport/transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAA2B,MAAM,cAAc,CAAC;AAEjG,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEnD;AAsED,wBAAgB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAUjE;AAsBD,wBAAsB,kBAAkB,CAAC,aAAa,EAAE,QAAQ,EAAE,iBAAiB,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqDrH"}
|
|
1
|
+
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/transport/transport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAA2B,MAAM,cAAc,CAAC;AAEjG;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEnD;AAsED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAUjE;AAsBD;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CAAC,aAAa,EAAE,QAAQ,EAAE,iBAAiB,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAqDrH"}
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Is graphql path.
|
|
3
|
+
*
|
|
4
|
+
* @param path The path.
|
|
5
|
+
* @returns The is graphql path result.
|
|
6
|
+
*/
|
|
1
7
|
export function isGraphqlPath(path) {
|
|
2
8
|
return path === '/graphql' || path === '/graphql/';
|
|
3
9
|
}
|
|
@@ -53,6 +59,13 @@ function createFetchBody(request, headers) {
|
|
|
53
59
|
}
|
|
54
60
|
return JSON.stringify(request.body);
|
|
55
61
|
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* To fetch request.
|
|
65
|
+
*
|
|
66
|
+
* @param request The request.
|
|
67
|
+
* @returns The to fetch request result.
|
|
68
|
+
*/
|
|
56
69
|
export function toFetchRequest(request) {
|
|
57
70
|
const headers = createFetchHeaders(request);
|
|
58
71
|
const body = createFetchBody(request, headers);
|
|
@@ -76,6 +89,14 @@ function readSetCookieValues(headers) {
|
|
|
76
89
|
}
|
|
77
90
|
return values;
|
|
78
91
|
}
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Write fetch response.
|
|
95
|
+
*
|
|
96
|
+
* @param fetchResponse The fetch response.
|
|
97
|
+
* @param frameworkResponse The framework response.
|
|
98
|
+
* @returns The write fetch response result.
|
|
99
|
+
*/
|
|
79
100
|
export async function writeFetchResponse(fetchResponse, frameworkResponse) {
|
|
80
101
|
frameworkResponse.setStatus(fetchResponse.status);
|
|
81
102
|
const setCookieValues = readSetCookieValues(fetchResponse.headers);
|
package/dist/types.d.ts
CHANGED
|
@@ -154,7 +154,6 @@ export type GraphqlRootOutputType = GraphqlRootOutputNamedType | GraphqlListType
|
|
|
154
154
|
export interface ResolverHandlerMetadata {
|
|
155
155
|
type: ResolverHandlerType;
|
|
156
156
|
fieldName?: string;
|
|
157
|
-
topics?: string | string[];
|
|
158
157
|
inputClass?: Function;
|
|
159
158
|
argTypes?: Record<string, GraphqlArgType>;
|
|
160
159
|
outputType?: GraphqlRootOutputType;
|
|
@@ -174,7 +173,6 @@ export interface ResolverHandlerDescriptor {
|
|
|
174
173
|
methodKey: MetadataPropertyKey;
|
|
175
174
|
methodName: string;
|
|
176
175
|
fieldName: string;
|
|
177
|
-
topics?: string | string[];
|
|
178
176
|
inputClass?: Function;
|
|
179
177
|
argFields: ArgFieldMetadata[];
|
|
180
178
|
argTypes?: Record<string, GraphqlArgType>;
|
|
@@ -192,14 +190,17 @@ export interface ResolverDescriptor {
|
|
|
192
190
|
scope: 'singleton' | 'request' | 'transient';
|
|
193
191
|
}
|
|
194
192
|
/**
|
|
195
|
-
* Public options for `GraphqlModule.forRoot(...)
|
|
193
|
+
* Public options for `GraphqlModule.forRoot(...)`.
|
|
196
194
|
*
|
|
197
195
|
* @remarks
|
|
198
196
|
* Keep README examples for end-to-end module wiring. Source hover docs here are
|
|
199
197
|
* meant to clarify how each option shapes the per-request execution pipeline.
|
|
200
198
|
*/
|
|
201
199
|
export interface GraphqlModuleOptions {
|
|
202
|
-
|
|
200
|
+
/**
|
|
201
|
+
* Provide a prebuilt executable `GraphQLSchema` when you want to own schema assembly yourself.
|
|
202
|
+
*/
|
|
203
|
+
schema?: GraphQLSchema;
|
|
203
204
|
resolvers?: Function[];
|
|
204
205
|
context?: (ctx: GraphqlRequestContext) => Record<string, unknown>;
|
|
205
206
|
graphiql?: boolean;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAElF;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,eAAiD,CAAC;AAE1F;;;;;GAKG;AACH,eAAO,MAAM,mCAAmC,eAAyD,CAAC;AAE1G;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,gBAAgB,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,gBAAgB,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3C,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,CAAC,2BAA2B,CAAC,CAAC,EAAE,SAAS,CAAC;IAC1C,CAAC,mCAAmC,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,OAAO,CAAC,CAAC;IACtE,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;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AE,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAC1C,UAAU,CAAC,EAAE,qBAAqB,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,yBAAyB,EAAE,CAAC;IACtC,KAAK,EAAE,KAAK,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,WAAW,GAAG,SAAS,GAAG,WAAW,CAAC;CAC9C;AAED;;;;;;GAMG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,OAAO,CAAC,EAAE,CAAC,GAAG,EAAE,qBAAqB,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClE,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;OAIG;IACH,MAAM,CAAC,EAAE,2BAA2B,GAAG,KAAK,CAAC;IAC7C,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;IACpB,aAAa,CAAC,EAAE,2BAA2B,CAAC;CAC7C"}
|
package/dist/types.js
CHANGED
|
@@ -124,7 +124,7 @@ export function isGraphqlListTypeRef(value) {
|
|
|
124
124
|
*/
|
|
125
125
|
|
|
126
126
|
/**
|
|
127
|
-
* Public options for `GraphqlModule.forRoot(...)
|
|
127
|
+
* Public options for `GraphqlModule.forRoot(...)`.
|
|
128
128
|
*
|
|
129
129
|
* @remarks
|
|
130
130
|
* Keep README examples for end-to-end module wiring. Source hover docs here are
|
package/package.json
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"yoga",
|
|
10
10
|
"api"
|
|
11
11
|
],
|
|
12
|
-
"version": "1.0.0-beta.
|
|
12
|
+
"version": "1.0.0-beta.4",
|
|
13
13
|
"private": false,
|
|
14
14
|
"license": "MIT",
|
|
15
15
|
"repository": {
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"graphql-ws": "^5.16.2",
|
|
42
42
|
"graphql-yoga": "^5.18.1",
|
|
43
43
|
"ws": "^8.18.3",
|
|
44
|
-
"@fluojs/core": "^1.0.0-beta.
|
|
45
|
-
"@fluojs/di": "^1.0.0-beta.
|
|
46
|
-
"@fluojs/http": "^1.0.0-beta.
|
|
47
|
-
"@fluojs/runtime": "^1.0.0-beta.
|
|
44
|
+
"@fluojs/core": "^1.0.0-beta.2",
|
|
45
|
+
"@fluojs/di": "^1.0.0-beta.5",
|
|
46
|
+
"@fluojs/http": "^1.0.0-beta.4",
|
|
47
|
+
"@fluojs/runtime": "^1.0.0-beta.5",
|
|
48
48
|
"@fluojs/validation": "^1.0.0-beta.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|