@tinkerstack/graphql-annotation 0.0.0 → 0.0.1
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/.turbo/turbo-build.log +6 -8
- package/dist/index.js +246 -225
- package/dist/index.mjs +241 -223
- package/package.json +5 -1
- package/src/modules/core/annotation.loader.ts +5 -6
- package/src/modules/core/annotation.resolver.ts +3 -2
|
@@ -23,6 +23,7 @@ import {
|
|
|
23
23
|
ResolverName,
|
|
24
24
|
} from "./annotation.constants";
|
|
25
25
|
import {
|
|
26
|
+
ANNOTATION_QUERY_NAME,
|
|
26
27
|
GraphQLAnnotationMeta,
|
|
27
28
|
GraphQLAnnotationResolver,
|
|
28
29
|
} from "./annotation.resolver";
|
|
@@ -123,8 +124,7 @@ export class GraphQLAnnotatedSchemaLoader {
|
|
|
123
124
|
// Remove `_annotations` from being merged to main schema
|
|
124
125
|
loaded.subschema.transforms = [
|
|
125
126
|
new FilterRootFields(
|
|
126
|
-
(op, fieldName) =>
|
|
127
|
-
!fieldName.endsWith(GraphQLAnnotationResolver.QUERY_NAME),
|
|
127
|
+
(op, fieldName) => !fieldName.endsWith(ANNOTATION_QUERY_NAME),
|
|
128
128
|
),
|
|
129
129
|
];
|
|
130
130
|
|
|
@@ -153,11 +153,11 @@ export class GraphQLAnnotatedSchemaLoader {
|
|
|
153
153
|
|
|
154
154
|
try {
|
|
155
155
|
type ExpectedResult = {
|
|
156
|
-
[
|
|
156
|
+
[ANNOTATION_QUERY_NAME]: GraphQLAnnotationMeta;
|
|
157
157
|
};
|
|
158
158
|
const res = await client.rawRequest<ExpectedResult>(`
|
|
159
159
|
query IntrospectAnnotations {
|
|
160
|
-
${
|
|
160
|
+
${ANNOTATION_QUERY_NAME} {
|
|
161
161
|
name
|
|
162
162
|
resolvers
|
|
163
163
|
}
|
|
@@ -165,7 +165,7 @@ export class GraphQLAnnotatedSchemaLoader {
|
|
|
165
165
|
`);
|
|
166
166
|
|
|
167
167
|
this._logger.log(`Loaded annotations for ${url}`);
|
|
168
|
-
return res.data[
|
|
168
|
+
return res.data[ANNOTATION_QUERY_NAME];
|
|
169
169
|
} catch (err) {
|
|
170
170
|
this._logger.warn(`Failed to load annotations at ${url}, assuming empty`);
|
|
171
171
|
return {} as GraphQLAnnotationMeta;
|
|
@@ -272,7 +272,6 @@ class GraphQLAnnotationResolverParamsFactory implements ParamsFactory {
|
|
|
272
272
|
argsContext: GraphQLAnnotationResolverArgs,
|
|
273
273
|
) {
|
|
274
274
|
if (!argsContext) return null;
|
|
275
|
-
console.log(type, possibleKey, argsContext);
|
|
276
275
|
|
|
277
276
|
const args = {
|
|
278
277
|
parentValue: argsContext[0],
|
|
@@ -23,12 +23,13 @@ export class GraphQLAnnotationMeta {
|
|
|
23
23
|
resolvers: GraphQLResolversAnnotations;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
export const ANNOTATION_QUERY_NAME = "_annotations";
|
|
27
|
+
|
|
26
28
|
@Resolver()
|
|
27
29
|
@Injectable()
|
|
28
30
|
export class GraphQLAnnotationResolver implements OnModuleInit {
|
|
29
31
|
private _logger = new Logger("GraphQLAnnotationModule");
|
|
30
32
|
|
|
31
|
-
public static QUERY_NAME = "_annotations";
|
|
32
33
|
constructor(
|
|
33
34
|
private readonly metadataScanner: MetadataScanner,
|
|
34
35
|
private readonly resolverDiscoveryService: ResolverDiscoveryService,
|
|
@@ -37,7 +38,7 @@ export class GraphQLAnnotationResolver implements OnModuleInit {
|
|
|
37
38
|
) {}
|
|
38
39
|
|
|
39
40
|
@Query(() => GraphQLAnnotationMeta, {
|
|
40
|
-
name:
|
|
41
|
+
name: ANNOTATION_QUERY_NAME,
|
|
41
42
|
})
|
|
42
43
|
async getGraphQLAnnotations() {
|
|
43
44
|
return {
|