chore(index): return ids only (#12543)
This commit is contained in:
1 parent
fca5ad77b4
commit
ebe5cc7acd
12 files changed
+92
-16
No files matched your search
@@ -204,7 +204,7 @@ export class Query {
|
||||
|
||||
const mainEntity = queryOptions.entity
|
||||
|
||||
const fields = queryOptions.fields.map((field) => mainEntity + "." + field)
|
||||
const fields = [mainEntity + ".id"]
|
||||
const filters = queryOptions.filters
|
||||
? { [mainEntity]: queryOptions.filters }
|
||||
: ({} as any)
|
||||
@@ -223,10 +223,17 @@ export class Query {
|
||||
filters,
|
||||
joinFilters,
|
||||
pagination,
|
||||
idsOnly: true,
|
||||
})) as unknown as GraphResultSet<TEntry>
|
||||
|
||||
delete queryOptions.filters
|
||||
|
||||
const idFilters = {
|
||||
id: indexResponse.data.map((item) => item.id),
|
||||
} as any
|
||||
|
||||
queryOptions.filters = idFilters
|
||||
|
||||
const graphOptions: RemoteQueryInput<TEntry> = {
|
||||
...queryOptions,
|
||||
pagination: {
|
||||
|
||||
@@ -45,6 +45,7 @@ type InternalParseExpandsParams = {
|
||||
implodeMapping: InternalImplodeMapping[]
|
||||
options?: RemoteJoinerOptions
|
||||
initialData?: any[]
|
||||
initialDataOnly?: boolean
|
||||
}
|
||||
|
||||
export class RemoteJoiner {
|
||||
@@ -922,6 +923,7 @@ export class RemoteJoiner {
|
||||
implodeMapping,
|
||||
options,
|
||||
initialData,
|
||||
initialDataOnly,
|
||||
} = params
|
||||
|
||||
const { parsedExpands, aliasRealPathMap } = this.parseProperties({
|
||||
@@ -932,7 +934,7 @@ export class RemoteJoiner {
|
||||
implodeMapping,
|
||||
})
|
||||
|
||||
if (initialData?.length) {
|
||||
if (initialData?.length && initialDataOnly) {
|
||||
this.createFilterFromInitialData({
|
||||
initialData: options?.initialData as any,
|
||||
parsedExpands,
|
||||
@@ -1524,6 +1526,7 @@ export class RemoteJoiner {
|
||||
implodeMapping,
|
||||
options,
|
||||
initialData: iniDataArray,
|
||||
initialDataOnly: options?.initialDataOnly,
|
||||
}
|
||||
|
||||
const parsedExpands = this.parseExpands(parseExpandsConfig)
|
||||
|
||||
@@ -2,4 +2,4 @@ export * from "./common"
|
||||
export * from "./index-service-entry-points"
|
||||
export * from "./query-config"
|
||||
export * from "./service"
|
||||
export * from "./sotrage-provider"
|
||||
export * from "./storage-provider"
|
||||
@@ -63,6 +63,7 @@ export type IndexQueryConfig<TEntry extends string> = {
|
||||
filters?: IndexFilters<TEntry>
|
||||
joinFilters?: IndexFilters<TEntry>
|
||||
pagination?: Partial<IndexQueryInput<TEntry>["pagination"]>
|
||||
idsOnly?: boolean
|
||||
}
|
||||
|
||||
export type QueryFunctionReturnPagination = {
|
||||
|
||||
File renamed without changes.
@@ -86,6 +86,7 @@ export interface RemoteJoinerOptions {
|
||||
throwIfKeyNotFound?: boolean
|
||||
throwIfRelationNotFound?: boolean | string[]
|
||||
initialData?: object | object[]
|
||||
initialDataOnly?: boolean
|
||||
}
|
||||
|
||||
export interface RemoteNestedExpands {
|
||||
|
||||
Reference in new issue
Block a user