|
1
|
import { QueryContextType } from "@medusajs/types" |
|
2
|
|
|
3
|
type QueryContexFnType = { |
|
4
|
(query: Record<string, unknown>): Record<string, unknown> |
|
5
|
isQueryContext: (obj: any) => boolean |
|
6
|
} |
|
7
|
|
|
8
|
const __type = "QueryContext" |
|
9
|
|
|
10
|
function QueryContextFn(query: Record<string, unknown>): QueryContextType { |
|
11
|
return { |
|
12
|
...query, |
|
13
|
__type, |
|
14
|
} |
|
15
|
} |
|
16
|
|
|
17
|
QueryContextFn.isQueryContext = (obj: any) => { |
|
18
|
return obj.__type === __type |
|
19
|
} |
|
20
|
|
|
21
|
export const QueryContext: QueryContexFnType = QueryContextFn |