complexqa_frontend_core 1.18.6 → 1.18.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -67,6 +67,32 @@ export function isDefaultSearchPayload(payload)
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
|
|
70
|
+
/**
|
|
71
|
+
* @param {{ response: Promise<*>|*, payload: * }} result
|
|
72
|
+
* @returns {Promise<{ response: *, payload: * }>}
|
|
73
|
+
*/
|
|
74
|
+
async function materializeSearchResult(result)
|
|
75
|
+
{
|
|
76
|
+
return {
|
|
77
|
+
response: await result.response,
|
|
78
|
+
payload : result.payload,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @param {{ response: *, payload: * }} result
|
|
85
|
+
* @returns {{ response: Promise<*>, payload: * }}
|
|
86
|
+
*/
|
|
87
|
+
function wrapSearchResult(result)
|
|
88
|
+
{
|
|
89
|
+
return {
|
|
90
|
+
response: Promise.resolve(result.response),
|
|
91
|
+
payload : result.payload,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
|
|
70
96
|
/**
|
|
71
97
|
* @param {object} apiInstance
|
|
72
98
|
* @param {string} methodName
|
|
@@ -100,11 +126,13 @@ export async function resolveCachedSearch(
|
|
|
100
126
|
|
|
101
127
|
if (cached !== undefined)
|
|
102
128
|
{
|
|
103
|
-
return
|
|
129
|
+
return wrapSearchResult(clone_object(cached));
|
|
104
130
|
}
|
|
105
131
|
|
|
106
|
-
const result
|
|
107
|
-
|
|
132
|
+
const result = await searchFn(payload);
|
|
133
|
+
const materialized = await materializeSearchResult(result);
|
|
134
|
+
|
|
135
|
+
cacheStore.set(cacheKey, clone_object(materialized), ttlMs);
|
|
108
136
|
|
|
109
|
-
return
|
|
137
|
+
return wrapSearchResult(materialized);
|
|
110
138
|
}
|