-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
025a135
commit c7efc99
Showing
9 changed files
with
254 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 6 additions & 1 deletion
7
...runner/factories/query-result-getters/interfaces/query-result-getter-handler.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
import { Record as ObjectRecord } from 'src/engine/api/graphql/workspace-query-builder/interfaces/record.interface'; | ||
|
||
export interface QueryResultGetterHandlerInterface { | ||
handle(result: any, workspaceId: string): Promise<any>; | ||
handle( | ||
objectRecord: ObjectRecord, | ||
workspaceId: string, | ||
): Promise<ObjectRecord>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
...raphql/workspace-query-runner/factories/query-result-getters/utils/isResultAConnection.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { isDefined } from 'class-validator'; | ||
|
||
import { Record as ObjectRecord } from 'src/engine/api/graphql/workspace-query-builder/interfaces/record.interface'; | ||
import { IConnection } from 'src/engine/api/graphql/workspace-query-runner/interfaces/connection.interface'; | ||
import { IEdge } from 'src/engine/api/graphql/workspace-query-runner/interfaces/edge.interface'; | ||
|
||
import { PossibleFieldValue } from 'src/engine/api/graphql/workspace-query-runner/factories/query-result-getters/query-result-getters.factory'; | ||
|
||
export const isPossibleFieldValueAConnection = ( | ||
result: PossibleFieldValue, | ||
): result is IConnection<ObjectRecord, IEdge<ObjectRecord>> => { | ||
return isDefined((result as any).edges); | ||
}; | ||
|
||
export const isPossibleFieldValueARecordArray = ( | ||
result: PossibleFieldValue, | ||
): result is { records: ObjectRecord[] } => { | ||
return Array.isArray((result as any).records); | ||
}; | ||
|
||
export const isPossibleFieldValueARecord = ( | ||
result: PossibleFieldValue, | ||
): result is ObjectRecord => { | ||
return ( | ||
!isPossibleFieldValueAConnection(result) && | ||
!isPossibleFieldValueARecordArray(result) | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.