@powerhousedao/reactor-browser 6.0.0-dev.178 → 6.0.0-dev.179
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/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -2197,16 +2197,20 @@ function buildBatchDocumentWithOperationsQuery(identifier, view, filters, paging
|
|
|
2197
2197
|
*/
|
|
2198
2198
|
function createClient(urlOrGQLClient, middleware) {
|
|
2199
2199
|
const client = typeof urlOrGQLClient === "string" ? new GraphQLClient(urlOrGQLClient) : urlOrGQLClient;
|
|
2200
|
+
const runWithMiddleware = async (operationName, run) => {
|
|
2201
|
+
if (!middleware) return run();
|
|
2202
|
+
return middleware(run, operationName, "query");
|
|
2203
|
+
};
|
|
2200
2204
|
return {
|
|
2201
2205
|
...getSdk(client, middleware),
|
|
2202
2206
|
async BatchGetDocumentOperations(filters, pagings) {
|
|
2203
2207
|
const { query, variables } = buildBatchOperationsQuery(filters, pagings);
|
|
2204
|
-
const data = await client.request(query, variables);
|
|
2208
|
+
const data = await runWithMiddleware("BatchGetDocumentOperations", (requestHeaders) => client.request(query, variables, requestHeaders));
|
|
2205
2209
|
return filters.map((_, i) => data[`scope_${i}`]);
|
|
2206
2210
|
},
|
|
2207
2211
|
async BatchGetDocumentWithOperations(identifier, view, filters, pagings) {
|
|
2208
2212
|
const { query, variables } = buildBatchDocumentWithOperationsQuery(identifier, view, filters, pagings);
|
|
2209
|
-
const data = await client.request(query, variables);
|
|
2213
|
+
const data = await runWithMiddleware("BatchGetDocumentWithOperations", (requestHeaders) => client.request(query, variables, requestHeaders));
|
|
2210
2214
|
return {
|
|
2211
2215
|
document: data.document ?? null,
|
|
2212
2216
|
operations: filters.map((_, i) => data[`scope_${i}`])
|