chore(): Improve caching rollout (#13702)

* chore(): Improve caching rollout

* Create bright-cobras-complain.md

* chore(): Improve caching rollout

* downgrade orm to 6.4.3

* chore(): Improve caching rollout

* chore(): Improve caching rollout

* chore(): Improve caching rollout

* chore(): Improve caching rollout

* chore(): Improve caching rollout

* fix

* update changeset

* update modules definition

* update engine tests

* update engine tests

* improve integration

* improve integration

* gracefully disconnect

* update test

* another attempt

* another attempt

* fix workflow storage

* fix remote joiner

* fix remote joiner

---------

Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
This commit is contained in:
Adrien de Peretti
2025-10-08 17:44:00 +02:00
committed by GitHub
co-authored by Oli Juhl
parent e9b7a8c1f3
commit 0cbd9f0bc3
13 changed files with 248 additions and 182 deletions
@@ -307,7 +307,7 @@ export class RemoteQuery {
private async executeFetchRequest(params: {
expand: RemoteExpandProperty
keyField: string
ids?: (unknown | unknown[])[]
ids?: (unknown | unknown[])[] | object
relationship?: JoinerRelationship
}): Promise<{
data: unknown[] | { [path: string]: unknown }
@@ -351,10 +351,6 @@ export class RemoteQuery {
}
}
if (ids) {
filters[keyField] = ids
}
delete options.args?.[BASE_PREFIX]
if (Object.keys(options.args ?? {}).length) {
filters = {
@@ -365,6 +361,28 @@ export class RemoteQuery {
}
const hasPagination = this.hasPagination(options)
const isIdsArray = Array.isArray(ids)
const idsLength = isIdsArray ? ids.length : 1
if (ids) {
if (isIdsArray && !idsLength) {
if (hasPagination) {
return {
data: {
rows: [],
metadata: this.buildPagination(options, 0),
},
path: "rows",
}
} else {
return {
data: [],
}
}
}
filters[keyField] = ids
}
let methodName = hasPagination ? "listAndCount" : "list"
@@ -380,11 +398,11 @@ export class RemoteQuery {
)
}
if (ids?.length && !hasPagination) {
if (isIdsArray && idsLength && !hasPagination) {
options.take = null
}
if (ids && ids.length >= MAX_BATCH_SIZE && !hasPagination) {
if (isIdsArray && idsLength >= MAX_BATCH_SIZE && !hasPagination) {
const data = await this.fetchRemoteDataBatched({
serviceName: serviceConfig.serviceName,
keyField,