Skip to content

Commit d9f7446

Browse files
committed
feat: create util functions for auto schema file config
1 parent d6b77b9 commit d9f7446

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { isString, isObject } from '@nestjs/common/utils/shared.utils';
2+
import { AutoSchemaFileValue, UseFed2Value } from '../interfaces';
3+
4+
export function getPathForAutoSchemaFile(
5+
autoSchemaFile: AutoSchemaFileValue,
6+
): string | null {
7+
if (isString(autoSchemaFile)) {
8+
return autoSchemaFile;
9+
}
10+
if (isObject(autoSchemaFile) && autoSchemaFile.path) {
11+
return autoSchemaFile.path;
12+
}
13+
return null;
14+
}
15+
16+
export function getFederation2Info(
17+
autoSchemaFile: AutoSchemaFileValue,
18+
): UseFed2Value {
19+
if (isObject(autoSchemaFile)) {
20+
return autoSchemaFile.useFed2;
21+
}
22+
return false;
23+
}

packages/graphql/lib/utils/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
export * from './auto-schema-file.util';
12
export * from './extend.util';
23
export * from './extract-metadata.util';
34
export * from './generate-token.util';
45
export * from './get-number-of-arguments.util';
56
export * from './normalize-route-path.util';
6-
export * from './remove-temp.util';
77
export * from './object.util';
8+
export * from './remove-temp.util';

0 commit comments

Comments
 (0)