@sanity/client 7.11.2-audience-decide.0 → 7.11.2-audience-decide.2
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.browser.cjs +107 -16
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +107 -16
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +108 -17
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +108 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/SanityClient.ts +26 -0
- package/src/data/dataMethods.ts +118 -14
- package/src/data/decideResponseProcessor.ts +3 -0
- package/umd/sanityClient.js +107 -16
- package/umd/sanityClient.min.js +2 -2
package/package.json
CHANGED
package/src/SanityClient.ts
CHANGED
|
@@ -225,6 +225,19 @@ export class ObservableSanityClient {
|
|
|
225
225
|
params?: Q,
|
|
226
226
|
options?: QueryOptions,
|
|
227
227
|
): Observable<RawQueryResponse<R> | R> {
|
|
228
|
+
// Log the public API call to track parameter flow
|
|
229
|
+
// eslint-disable-next-line no-console
|
|
230
|
+
console.log('ObservableSanityClient.fetch called with:', {
|
|
231
|
+
query: query.substring(0, 100) + (query.length > 100 ? '...' : ''),
|
|
232
|
+
params,
|
|
233
|
+
options: {
|
|
234
|
+
...options,
|
|
235
|
+
decideParameters: options?.decideParameters,
|
|
236
|
+
},
|
|
237
|
+
clientConfig: {
|
|
238
|
+
decideParameters: this.#clientConfig.decideParameters,
|
|
239
|
+
},
|
|
240
|
+
})
|
|
228
241
|
return dataMethods._fetch<R, Q>(
|
|
229
242
|
this,
|
|
230
243
|
this.#httpRequest,
|
|
@@ -1272,6 +1285,19 @@ export class SanityClient {
|
|
|
1272
1285
|
params?: Q,
|
|
1273
1286
|
options?: QueryOptions,
|
|
1274
1287
|
): Promise<RawQueryResponse<ClientReturn<G, R>> | ClientReturn<G, R>> {
|
|
1288
|
+
// Log the public API call to track parameter flow
|
|
1289
|
+
// eslint-disable-next-line no-console
|
|
1290
|
+
console.log('SanityClient.fetch called with:', {
|
|
1291
|
+
query: query.substring(0, 100) + (query.length > 100 ? '...' : ''),
|
|
1292
|
+
params,
|
|
1293
|
+
options: {
|
|
1294
|
+
...options,
|
|
1295
|
+
decideParameters: options?.decideParameters,
|
|
1296
|
+
},
|
|
1297
|
+
clientConfig: {
|
|
1298
|
+
decideParameters: this.#clientConfig.decideParameters,
|
|
1299
|
+
},
|
|
1300
|
+
})
|
|
1275
1301
|
return lastValueFrom(
|
|
1276
1302
|
dataMethods._fetch<ClientReturn<G, R>, Q>(
|
|
1277
1303
|
this,
|
package/src/data/dataMethods.ts
CHANGED
|
@@ -87,6 +87,17 @@ export function _fetch<R, Q>(
|
|
|
87
87
|
_params: Q = {} as Q,
|
|
88
88
|
options: QueryOptions = {},
|
|
89
89
|
): Observable<RawQueryResponse<R> | R> {
|
|
90
|
+
// Entry logging to track all incoming parameters
|
|
91
|
+
// eslint-disable-next-line no-console
|
|
92
|
+
console.log('_fetch called with:', {
|
|
93
|
+
query: query.substring(0, 100) + (query.length > 100 ? '...' : ''),
|
|
94
|
+
params: _params,
|
|
95
|
+
options: {
|
|
96
|
+
...options,
|
|
97
|
+
decideParameters: options.decideParameters,
|
|
98
|
+
},
|
|
99
|
+
stegaEnabled: _stega?.enabled,
|
|
100
|
+
})
|
|
90
101
|
const stega =
|
|
91
102
|
'stega' in options
|
|
92
103
|
? {
|
|
@@ -100,7 +111,17 @@ export function _fetch<R, Q>(
|
|
|
100
111
|
|
|
101
112
|
// Helper function to apply decide processing to response data
|
|
102
113
|
const processDecideResponse = (response: Any): Any => {
|
|
114
|
+
// eslint-disable-next-line no-console
|
|
115
|
+
console.log('inside processDecideResponse:', {
|
|
116
|
+
audience: options.decideParameters?.audience,
|
|
117
|
+
decideParameters: options.decideParameters?.audience,
|
|
118
|
+
})
|
|
103
119
|
if (options.decideParameters && options.decideParameters.audience) {
|
|
120
|
+
// eslint-disable-next-line no-console
|
|
121
|
+
console.log('Processing response with decideParameters:', {
|
|
122
|
+
audience: options.decideParameters.audience,
|
|
123
|
+
decideParameters: options.decideParameters,
|
|
124
|
+
})
|
|
104
125
|
const processedData = processDecideFields(response, options.decideParameters)
|
|
105
126
|
return processedData
|
|
106
127
|
}
|
|
@@ -489,6 +510,20 @@ export function _dataRequest(
|
|
|
489
510
|
body: Any,
|
|
490
511
|
options: Any = {},
|
|
491
512
|
): Any {
|
|
513
|
+
// Log dataRequest call to trace options preservation
|
|
514
|
+
// eslint-disable-next-line no-console
|
|
515
|
+
console.log('_dataRequest called with:', {
|
|
516
|
+
endpoint,
|
|
517
|
+
body: endpoint === 'query' ? {
|
|
518
|
+
query: body.query?.substring(0, 100) + (body.query?.length > 100 ? '...' : ''),
|
|
519
|
+
params: body.params,
|
|
520
|
+
} : body,
|
|
521
|
+
options: {
|
|
522
|
+
...options,
|
|
523
|
+
decideParameters: options.decideParameters,
|
|
524
|
+
perspective: options.perspective,
|
|
525
|
+
},
|
|
526
|
+
})
|
|
492
527
|
const isMutation = endpoint === 'mutate'
|
|
493
528
|
const isAction = endpoint === 'actions'
|
|
494
529
|
const isQuery = endpoint === 'query'
|
|
@@ -526,6 +561,22 @@ export function _dataRequest(
|
|
|
526
561
|
useCdn: options.useCdn,
|
|
527
562
|
}
|
|
528
563
|
|
|
564
|
+
// Log request options before calling _requestObservable
|
|
565
|
+
// eslint-disable-next-line no-console
|
|
566
|
+
console.log('_dataRequest calling _requestObservable with reqOptions:', {
|
|
567
|
+
...reqOptions,
|
|
568
|
+
decideParameters: reqOptions.decideParameters,
|
|
569
|
+
perspective: reqOptions.perspective,
|
|
570
|
+
body: useGet
|
|
571
|
+
? undefined
|
|
572
|
+
: endpoint === 'query'
|
|
573
|
+
? {
|
|
574
|
+
query: body.query?.substring(0, 100) + (body.query?.length > 100 ? '...' : ''),
|
|
575
|
+
params: body.params,
|
|
576
|
+
}
|
|
577
|
+
: body,
|
|
578
|
+
})
|
|
579
|
+
|
|
529
580
|
return _requestObservable(client, httpRequest, reqOptions).pipe(
|
|
530
581
|
filter(isResponse),
|
|
531
582
|
map(getBody),
|
|
@@ -609,6 +660,17 @@ export function _requestObservable<R>(
|
|
|
609
660
|
const uri = options.url || (options.uri as string)
|
|
610
661
|
const config = client.config()
|
|
611
662
|
|
|
663
|
+
// Log entry to _requestObservable to track parameter flow
|
|
664
|
+
// eslint-disable-next-line no-console
|
|
665
|
+
console.log('_requestObservable called with options:', {
|
|
666
|
+
uri,
|
|
667
|
+
method: options.method,
|
|
668
|
+
decideParameters: options.decideParameters,
|
|
669
|
+
perspective: options.perspective,
|
|
670
|
+
query: options.query,
|
|
671
|
+
configDecideParameters: config.decideParameters,
|
|
672
|
+
})
|
|
673
|
+
|
|
612
674
|
// If the `canUseCdn`-option is not set we detect it automatically based on the method + URL.
|
|
613
675
|
// Only the /data endpoint is currently available through API-CDN.
|
|
614
676
|
const canUseCdn =
|
|
@@ -660,19 +722,44 @@ export function _requestObservable<R>(
|
|
|
660
722
|
|
|
661
723
|
// Process decideParameters
|
|
662
724
|
const decideParametersOption = options.decideParameters || config.decideParameters
|
|
725
|
+
// eslint-disable-next-line no-console
|
|
726
|
+
console.log('Processing decideParameters:', {
|
|
727
|
+
optionsDecideParameters: options.decideParameters,
|
|
728
|
+
configDecideParameters: config.decideParameters,
|
|
729
|
+
finalDecideParametersOption: decideParametersOption,
|
|
730
|
+
})
|
|
731
|
+
|
|
663
732
|
if (decideParametersOption && typeof decideParametersOption === 'object') {
|
|
733
|
+
// eslint-disable-next-line no-console
|
|
734
|
+
console.log('DecideParameters received, transforming to query params:', decideParametersOption)
|
|
735
|
+
|
|
664
736
|
// Add decide parameters to query string
|
|
737
|
+
const decideQueryParams = Object.keys(decideParametersOption).reduce(
|
|
738
|
+
(acc, key) => {
|
|
739
|
+
// Prefix decide parameters to avoid conflicts
|
|
740
|
+
acc[`decide.${key}`] = decideParametersOption[key]
|
|
741
|
+
return acc
|
|
742
|
+
},
|
|
743
|
+
{} as Record<string, unknown>,
|
|
744
|
+
)
|
|
745
|
+
|
|
746
|
+
// eslint-disable-next-line no-console
|
|
747
|
+
console.log('DecideParameters transformed to query params:', decideQueryParams)
|
|
748
|
+
|
|
749
|
+
const oldQuery = options.query
|
|
665
750
|
options.query = {
|
|
666
751
|
...options.query,
|
|
667
|
-
...
|
|
668
|
-
(acc, key) => {
|
|
669
|
-
// Prefix decide parameters to avoid conflicts
|
|
670
|
-
acc[`decide.${key}`] = decideParametersOption[key]
|
|
671
|
-
return acc
|
|
672
|
-
},
|
|
673
|
-
{} as Record<string, unknown>,
|
|
674
|
-
),
|
|
752
|
+
...decideQueryParams,
|
|
675
753
|
}
|
|
754
|
+
|
|
755
|
+
// eslint-disable-next-line no-console
|
|
756
|
+
console.log('Updated query object:', {
|
|
757
|
+
oldQuery,
|
|
758
|
+
newQuery: options.query,
|
|
759
|
+
})
|
|
760
|
+
} else {
|
|
761
|
+
// eslint-disable-next-line no-console
|
|
762
|
+
console.log('No decideParameters to process or invalid format')
|
|
676
763
|
}
|
|
677
764
|
|
|
678
765
|
if (options.lastLiveEventId) {
|
|
@@ -688,12 +775,29 @@ export function _requestObservable<R>(
|
|
|
688
775
|
}
|
|
689
776
|
}
|
|
690
777
|
|
|
691
|
-
const
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
778
|
+
const finalOptions = Object.assign({}, options, {
|
|
779
|
+
url: _getUrl(client, uri, useCdn),
|
|
780
|
+
})
|
|
781
|
+
|
|
782
|
+
// Log final options before calling requestOptions
|
|
783
|
+
// eslint-disable-next-line no-console
|
|
784
|
+
console.log('Final options before requestOptions call:', {
|
|
785
|
+
url: finalOptions.url,
|
|
786
|
+
decideParameters: finalOptions.decideParameters,
|
|
787
|
+
query: finalOptions.query,
|
|
788
|
+
method: finalOptions.method,
|
|
789
|
+
})
|
|
790
|
+
|
|
791
|
+
const reqOptions = requestOptions(config, finalOptions) as RequestOptions
|
|
792
|
+
|
|
793
|
+
// Log final reqOptions that will be used for HTTP request
|
|
794
|
+
// eslint-disable-next-line no-console
|
|
795
|
+
console.log('Final reqOptions from requestOptions:', {
|
|
796
|
+
method: reqOptions.method,
|
|
797
|
+
headers: reqOptions.headers,
|
|
798
|
+
query: reqOptions.query,
|
|
799
|
+
// Note: URL is handled separately in the HTTP request
|
|
800
|
+
})
|
|
697
801
|
|
|
698
802
|
const request = new Observable<HttpRequestEvent<R>>((subscriber) =>
|
|
699
803
|
httpRequest(reqOptions, config.requester!).subscribe(subscriber),
|
|
@@ -100,6 +100,9 @@ export function processDecideFields(data: unknown, decideParameters: DecideParam
|
|
|
100
100
|
return data
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
// eslint-disable-next-line no-console
|
|
104
|
+
console.log('Starting decide field processing with parameters:', decideParameters)
|
|
105
|
+
|
|
103
106
|
try {
|
|
104
107
|
return processObjectRecursively(data, decideParameters)
|
|
105
108
|
} catch (error) {
|
package/umd/sanityClient.js
CHANGED
|
@@ -2833,6 +2833,7 @@ ${selectionOpts}`);
|
|
|
2833
2833
|
function processDecideFields(data, decideParameters) {
|
|
2834
2834
|
if (!decideParameters || !decideParameters.audience)
|
|
2835
2835
|
return data;
|
|
2836
|
+
console.log("Starting decide field processing with parameters:", decideParameters);
|
|
2836
2837
|
try {
|
|
2837
2838
|
return processObjectRecursively(data, decideParameters);
|
|
2838
2839
|
} catch (error) {
|
|
@@ -2860,10 +2861,25 @@ ${selectionOpts}`);
|
|
|
2860
2861
|
skipCrossDatasetReferenceValidation: options.skipCrossDatasetReferenceValidation
|
|
2861
2862
|
}), isResponse = (event) => event.type === "response", getBody = (event) => event.body, indexBy = (docs, attr) => docs.reduce((indexed, doc) => (indexed[attr(doc)] = doc, indexed), /* @__PURE__ */ Object.create(null)), getQuerySizeLimit = 11264;
|
|
2862
2863
|
function _fetch(client, httpRequest, _stega, query, _params = {}, options = {}) {
|
|
2864
|
+
console.log("_fetch called with:", {
|
|
2865
|
+
query: query.substring(0, 100) + (query.length > 100 ? "..." : ""),
|
|
2866
|
+
params: _params,
|
|
2867
|
+
options: {
|
|
2868
|
+
...options,
|
|
2869
|
+
decideParameters: options.decideParameters
|
|
2870
|
+
},
|
|
2871
|
+
stegaEnabled: _stega?.enabled
|
|
2872
|
+
});
|
|
2863
2873
|
const stega = "stega" in options ? {
|
|
2864
2874
|
..._stega || {},
|
|
2865
2875
|
...typeof options.stega == "boolean" ? { enabled: options.stega } : options.stega || {}
|
|
2866
|
-
} : _stega, params = stega.enabled ? stegaClean(_params) : _params, mapResponse = options.filterResponse === false ? (res) => res : (res) => res.result, processDecideResponse = (response) =>
|
|
2876
|
+
} : _stega, params = stega.enabled ? stegaClean(_params) : _params, mapResponse = options.filterResponse === false ? (res) => res : (res) => res.result, processDecideResponse = (response) => (console.log("inside processDecideResponse:", {
|
|
2877
|
+
audience: options.decideParameters?.audience,
|
|
2878
|
+
decideParameters: options.decideParameters?.audience
|
|
2879
|
+
}), options.decideParameters && options.decideParameters.audience ? (console.log("Processing response with decideParameters:", {
|
|
2880
|
+
audience: options.decideParameters.audience,
|
|
2881
|
+
decideParameters: options.decideParameters
|
|
2882
|
+
}), processDecideFields(response, options.decideParameters)) : response), { cache, next, ...opts } = {
|
|
2867
2883
|
// Opt out of setting a `signal` on an internal `fetch` if one isn't provided.
|
|
2868
2884
|
// This is necessary in React Server Components to avoid opting out of Request Memoization.
|
|
2869
2885
|
useAbortSignal: typeof options.signal < "u",
|
|
@@ -3031,6 +3047,18 @@ ${selectionOpts}`);
|
|
|
3031
3047
|
);
|
|
3032
3048
|
}
|
|
3033
3049
|
function _dataRequest(client, httpRequest, endpoint, body, options = {}) {
|
|
3050
|
+
console.log("_dataRequest called with:", {
|
|
3051
|
+
endpoint,
|
|
3052
|
+
body: endpoint === "query" ? {
|
|
3053
|
+
query: body.query?.substring(0, 100) + (body.query?.length > 100 ? "..." : ""),
|
|
3054
|
+
params: body.params
|
|
3055
|
+
} : body,
|
|
3056
|
+
options: {
|
|
3057
|
+
...options,
|
|
3058
|
+
decideParameters: options.decideParameters,
|
|
3059
|
+
perspective: options.perspective
|
|
3060
|
+
}
|
|
3061
|
+
});
|
|
3034
3062
|
const isMutation = endpoint === "mutate", isAction = endpoint === "actions", isQuery2 = endpoint === "query", strQuery = isMutation || isAction ? "" : encodeQueryString(body), useGet = !isMutation && !isAction && strQuery.length < getQuerySizeLimit, stringQuery = useGet ? strQuery : "", returnFirst = options.returnFirst, { timeout, token, tag, headers, returnQuery, lastLiveEventId, cacheMode } = options, uri = _getDataUrl(client, endpoint, stringQuery), reqOptions = {
|
|
3035
3063
|
method: useGet ? "GET" : "POST",
|
|
3036
3064
|
uri,
|
|
@@ -3053,7 +3081,15 @@ ${selectionOpts}`);
|
|
|
3053
3081
|
useAbortSignal: options.useAbortSignal,
|
|
3054
3082
|
useCdn: options.useCdn
|
|
3055
3083
|
};
|
|
3056
|
-
return
|
|
3084
|
+
return console.log("_dataRequest calling _requestObservable with reqOptions:", {
|
|
3085
|
+
...reqOptions,
|
|
3086
|
+
decideParameters: reqOptions.decideParameters,
|
|
3087
|
+
perspective: reqOptions.perspective,
|
|
3088
|
+
body: useGet ? void 0 : endpoint === "query" ? {
|
|
3089
|
+
query: body.query?.substring(0, 100) + (body.query?.length > 100 ? "..." : ""),
|
|
3090
|
+
params: body.params
|
|
3091
|
+
} : body
|
|
3092
|
+
}), _requestObservable(client, httpRequest, reqOptions).pipe(
|
|
3057
3093
|
filter(isResponse),
|
|
3058
3094
|
map(getBody),
|
|
3059
3095
|
map((res) => {
|
|
@@ -3077,7 +3113,16 @@ ${selectionOpts}`);
|
|
|
3077
3113
|
}
|
|
3078
3114
|
const hasDataConfig = (client) => client.config().dataset !== void 0 && client.config().projectId !== void 0 || client.config()["~experimental_resource"] !== void 0, isQuery = (client, uri) => hasDataConfig(client) && uri.startsWith(_getDataUrl(client, "query")), isMutate = (client, uri) => hasDataConfig(client) && uri.startsWith(_getDataUrl(client, "mutate")), isDoc = (client, uri) => hasDataConfig(client) && uri.startsWith(_getDataUrl(client, "doc", "")), isListener = (client, uri) => hasDataConfig(client) && uri.startsWith(_getDataUrl(client, "listen")), isHistory = (client, uri) => hasDataConfig(client) && uri.startsWith(_getDataUrl(client, "history", "")), isData = (client, uri) => uri.startsWith("/data/") || isQuery(client, uri) || isMutate(client, uri) || isDoc(client, uri) || isListener(client, uri) || isHistory(client, uri);
|
|
3079
3115
|
function _requestObservable(client, httpRequest, options) {
|
|
3080
|
-
const uri = options.url || options.uri, config = client.config()
|
|
3116
|
+
const uri = options.url || options.uri, config = client.config();
|
|
3117
|
+
console.log("_requestObservable called with options:", {
|
|
3118
|
+
uri,
|
|
3119
|
+
method: options.method,
|
|
3120
|
+
decideParameters: options.decideParameters,
|
|
3121
|
+
perspective: options.perspective,
|
|
3122
|
+
query: options.query,
|
|
3123
|
+
configDecideParameters: config.decideParameters
|
|
3124
|
+
});
|
|
3125
|
+
const canUseCdn = typeof options.canUseCdn > "u" ? ["GET", "HEAD"].indexOf(options.method || "GET") >= 0 && isData(client, uri) : options.canUseCdn;
|
|
3081
3126
|
let useCdn = (options.useCdn ?? config.useCdn) && canUseCdn;
|
|
3082
3127
|
const tag = options.tag && config.requestTagPrefix ? [config.requestTagPrefix, options.tag].join(".") : options.tag || config.requestTagPrefix;
|
|
3083
3128
|
if (tag && options.tag !== null && (options.query = { tag: requestTag(tag), ...options.query }), ["GET", "HEAD", "POST"].indexOf(options.method || "GET") >= 0 && isQuery(client, uri)) {
|
|
@@ -3090,20 +3135,46 @@ ${selectionOpts}`);
|
|
|
3090
3135
|
}, (Array.isArray(perspectiveOption) && perspectiveOption.length > 0 || // previewDrafts was renamed to drafts, but keep for backwards compat
|
|
3091
3136
|
perspectiveOption === "previewDrafts" || perspectiveOption === "drafts") && useCdn && (useCdn = false, printCdnPreviewDraftsWarning()));
|
|
3092
3137
|
const decideParametersOption = options.decideParameters || config.decideParameters;
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3138
|
+
if (console.log("Processing decideParameters:", {
|
|
3139
|
+
optionsDecideParameters: options.decideParameters,
|
|
3140
|
+
configDecideParameters: config.decideParameters,
|
|
3141
|
+
finalDecideParametersOption: decideParametersOption
|
|
3142
|
+
}), decideParametersOption && typeof decideParametersOption == "object") {
|
|
3143
|
+
console.log("DecideParameters received, transforming to query params:", decideParametersOption);
|
|
3144
|
+
const decideQueryParams = Object.keys(decideParametersOption).reduce(
|
|
3096
3145
|
(acc, key) => (acc[`decide.${key}`] = decideParametersOption[key], acc),
|
|
3097
3146
|
{}
|
|
3098
|
-
)
|
|
3099
|
-
|
|
3147
|
+
);
|
|
3148
|
+
console.log("DecideParameters transformed to query params:", decideQueryParams);
|
|
3149
|
+
const oldQuery = options.query;
|
|
3150
|
+
options.query = {
|
|
3151
|
+
...options.query,
|
|
3152
|
+
...decideQueryParams
|
|
3153
|
+
}, console.log("Updated query object:", {
|
|
3154
|
+
oldQuery,
|
|
3155
|
+
newQuery: options.query
|
|
3156
|
+
});
|
|
3157
|
+
} else
|
|
3158
|
+
console.log("No decideParameters to process or invalid format");
|
|
3159
|
+
options.lastLiveEventId && (options.query = { ...options.query, lastLiveEventId: options.lastLiveEventId }), options.returnQuery === false && (options.query = { returnQuery: "false", ...options.query }), useCdn && options.cacheMode == "noStale" && (options.query = { cacheMode: "noStale", ...options.query });
|
|
3100
3160
|
}
|
|
3101
|
-
const
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3161
|
+
const finalOptions = Object.assign({}, options, {
|
|
3162
|
+
url: _getUrl(client, uri, useCdn)
|
|
3163
|
+
});
|
|
3164
|
+
console.log("Final options before requestOptions call:", {
|
|
3165
|
+
url: finalOptions.url,
|
|
3166
|
+
decideParameters: finalOptions.decideParameters,
|
|
3167
|
+
query: finalOptions.query,
|
|
3168
|
+
method: finalOptions.method
|
|
3169
|
+
});
|
|
3170
|
+
const reqOptions = requestOptions(config, finalOptions);
|
|
3171
|
+
console.log("Final reqOptions from requestOptions:", {
|
|
3172
|
+
method: reqOptions.method,
|
|
3173
|
+
headers: reqOptions.headers,
|
|
3174
|
+
query: reqOptions.query
|
|
3175
|
+
// Note: URL is handled separately in the HTTP request
|
|
3176
|
+
});
|
|
3177
|
+
const request = new Observable(
|
|
3107
3178
|
(subscriber) => httpRequest(reqOptions, config.requester).subscribe(subscriber)
|
|
3108
3179
|
);
|
|
3109
3180
|
return options.signal ? request.pipe(_withAbortSignal(options.signal)) : request;
|
|
@@ -4323,7 +4394,17 @@ ${selectionOpts}`);
|
|
|
4323
4394
|
});
|
|
4324
4395
|
}
|
|
4325
4396
|
fetch(query, params, options) {
|
|
4326
|
-
return
|
|
4397
|
+
return console.log("ObservableSanityClient.fetch called with:", {
|
|
4398
|
+
query: query.substring(0, 100) + (query.length > 100 ? "..." : ""),
|
|
4399
|
+
params,
|
|
4400
|
+
options: {
|
|
4401
|
+
...options,
|
|
4402
|
+
decideParameters: options?.decideParameters
|
|
4403
|
+
},
|
|
4404
|
+
clientConfig: {
|
|
4405
|
+
decideParameters: this.#clientConfig.decideParameters
|
|
4406
|
+
}
|
|
4407
|
+
}), _fetch(
|
|
4327
4408
|
this,
|
|
4328
4409
|
this.#httpRequest,
|
|
4329
4410
|
this.#clientConfig.stega,
|
|
@@ -4587,7 +4668,17 @@ ${selectionOpts}`);
|
|
|
4587
4668
|
});
|
|
4588
4669
|
}
|
|
4589
4670
|
fetch(query, params, options) {
|
|
4590
|
-
return
|
|
4671
|
+
return console.log("SanityClient.fetch called with:", {
|
|
4672
|
+
query: query.substring(0, 100) + (query.length > 100 ? "..." : ""),
|
|
4673
|
+
params,
|
|
4674
|
+
options: {
|
|
4675
|
+
...options,
|
|
4676
|
+
decideParameters: options?.decideParameters
|
|
4677
|
+
},
|
|
4678
|
+
clientConfig: {
|
|
4679
|
+
decideParameters: this.#clientConfig.decideParameters
|
|
4680
|
+
}
|
|
4681
|
+
}), lastValueFrom(
|
|
4591
4682
|
_fetch(
|
|
4592
4683
|
this,
|
|
4593
4684
|
this.#httpRequest,
|