Comparing version 3.0.0-canary-20240508124421.8a09a480ab3ad2ccfd32a283372c22420727db92 to 3.0.0-canary-20240508182406.d91114b9cc39d7e63c2b0ca6d4cf0d552cd78484
@@ -127,2 +127,2 @@ import { type BaseGeneratedSchema, type FetchOptions } from '.'; | ||
}; | ||
export declare const createResolvers: <TSchema extends BaseGeneratedSchema>({ aliasLength, batchWindow, cache: clientCache, debugger: debug, depthLimit, fetchOptions, fetchOptions: { cachePolicy: defaultCachePolicy, retryPolicy: defaultRetryPoliy, }, scalars, schema, parentContext, }: CreateResolversOptions) => Resolvers<TSchema>; | ||
export declare const createResolvers: <TSchema extends BaseGeneratedSchema>({ aliasLength, batchWindow, cache: targetCache, debugger: debug, depthLimit, fetchOptions, fetchOptions: { cachePolicy: defaultCachePolicy, retryPolicy: defaultRetryPoliy, }, scalars, schema, parentContext, }: CreateResolversOptions) => Resolvers<TSchema>; |
@@ -5,2 +5,3 @@ 'use strict'; | ||
const multidict = require('multidict'); | ||
const index = require('../Accessor/index.js'); | ||
@@ -25,3 +26,3 @@ require('../Cache/index.js'); | ||
batchWindow, | ||
cache: clientCache, | ||
cache: targetCache, | ||
debugger: debug, | ||
@@ -38,2 +39,3 @@ depthLimit, | ||
}) => { | ||
const correlatedCaches = new multidict.MultiDict(); | ||
const createResolver = ({ | ||
@@ -50,3 +52,3 @@ cachePolicy = defaultCachePolicy, | ||
aliasLength, | ||
cache: clientCache, | ||
cache: targetCache, | ||
depthLimit, | ||
@@ -81,8 +83,9 @@ cachePolicy, | ||
} | ||
const selectionsCacheKey = operationName != null ? operationName : ""; | ||
const selectionsCacheKey = `${operationName != null ? operationName : cachePolicy === "no-store" ? "no-store" : "default"}`; | ||
const pendingSelections = batching.addSelections( | ||
clientCache, | ||
targetCache, | ||
selectionsCacheKey, | ||
selections | ||
); | ||
correlatedCaches.set(pendingSelections, context$1.cache); | ||
if (!pendingQueries.has(pendingSelections)) { | ||
@@ -93,3 +96,3 @@ pendingQueries.set( | ||
Promise.resolve().then(async () => { | ||
var _a; | ||
var _a, _b; | ||
if (batchWindow) { | ||
@@ -99,3 +102,3 @@ await new Promise((resolve2) => setTimeout(resolve2, batchWindow)); | ||
const uniqueSelections = /* @__PURE__ */ new Set(); | ||
(_a = batching.getSelectionsSet(clientCache, selectionsCacheKey)) == null ? void 0 : _a.forEach( | ||
(_a = batching.getSelectionsSet(targetCache, selectionsCacheKey)) == null ? void 0 : _a.forEach( | ||
(selections2) => { | ||
@@ -108,3 +111,3 @@ selections2.forEach((selection) => { | ||
pendingQueries.delete(pendingSelections); | ||
batching.delSelectionSet(clientCache, selectionsCacheKey); | ||
batching.delSelectionSet(targetCache, selectionsCacheKey); | ||
const results = await resolveSelections.fetchSelections(uniqueSelections, { | ||
@@ -117,7 +120,10 @@ cache: context$1.cache, | ||
}); | ||
updateCaches.updateCaches( | ||
results, | ||
cachePolicy !== "no-store" && context$1.cache !== clientCache ? [context$1.cache, clientCache] : [context$1.cache], | ||
{ skipNotify: !context$1.notifyCacheUpdate } | ||
); | ||
const targetCaches = (_b = correlatedCaches.get(pendingSelections)) != null ? _b : /* @__PURE__ */ new Set(); | ||
if (cachePolicy !== "no-store") { | ||
targetCaches.add(targetCache); | ||
} | ||
updateCaches.updateCaches(results, [...targetCaches], { | ||
skipNotify: !context$1.notifyCacheUpdate | ||
}); | ||
correlatedCaches.delete(targetCache); | ||
return results; | ||
@@ -183,3 +189,3 @@ }) | ||
[{ data, error, extensions: extensions2 }], | ||
cachePolicy !== "no-store" && context$1.cache !== clientCache ? [context$1.cache, clientCache] : [context$1.cache], | ||
cachePolicy !== "no-store" && context$1.cache !== targetCache ? [context$1.cache, targetCache] : [context$1.cache], | ||
{ skipNotify: !context$1.notifyCacheUpdate } | ||
@@ -186,0 +192,0 @@ ); |
{ | ||
"name": "gqty", | ||
"version": "3.0.0-canary-20240508124421.8a09a480ab3ad2ccfd32a283372c22420727db92", | ||
"version": "3.0.0-canary-20240508182406.d91114b9cc39d7e63c2b0ca6d4cf0d552cd78484", | ||
"description": "gqty client without queries", | ||
@@ -5,0 +5,0 @@ "sideEffects": false, |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
281197
8027