@shopify/shopify-api 11.12.0 → 11.13.0
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/cjs/lib/clients/common.js +38 -2
- package/dist/cjs/lib/clients/common.js.map +1 -1
- package/dist/cjs/lib/version.js +1 -1
- package/dist/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/dist/esm/lib/clients/common.mjs +38 -2
- package/dist/esm/lib/clients/common.mjs.map +1 -1
- package/dist/esm/lib/version.mjs +1 -1
- package/dist/esm/tsconfig.build.tsbuildinfo +1 -1
- package/dist/ts/lib/clients/common.d.ts.map +1 -1
- package/dist/ts/lib/version.d.ts +1 -1
- package/dist/ts/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +10 -10
|
@@ -17,6 +17,32 @@ function getUserAgent(config) {
|
|
|
17
17
|
}
|
|
18
18
|
return userAgentPrefix;
|
|
19
19
|
}
|
|
20
|
+
function serializeResponse(response) {
|
|
21
|
+
if (!response) {
|
|
22
|
+
return { error: 'No response object provided' };
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
const { status, statusText, ok, redirected, type, url, headers } = response;
|
|
26
|
+
const serialized = {
|
|
27
|
+
status,
|
|
28
|
+
statusText,
|
|
29
|
+
ok,
|
|
30
|
+
redirected,
|
|
31
|
+
type,
|
|
32
|
+
url,
|
|
33
|
+
};
|
|
34
|
+
if (headers?.entries) {
|
|
35
|
+
serialized.headers = Object.fromEntries(headers.entries());
|
|
36
|
+
}
|
|
37
|
+
else if (headers) {
|
|
38
|
+
serialized.headers = headers;
|
|
39
|
+
}
|
|
40
|
+
return serialized;
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
return response;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
20
46
|
function clientLoggerFactory(config) {
|
|
21
47
|
return (logContent) => {
|
|
22
48
|
if (config.logger.httpRequests) {
|
|
@@ -25,7 +51,7 @@ function clientLoggerFactory(config) {
|
|
|
25
51
|
const responseLog = logContent.content;
|
|
26
52
|
index.logger(config).debug('Received response for HTTP request', {
|
|
27
53
|
requestParams: JSON.stringify(responseLog.requestParams),
|
|
28
|
-
response: JSON.stringify(responseLog.response),
|
|
54
|
+
response: JSON.stringify(serializeResponse(responseLog.response)),
|
|
29
55
|
});
|
|
30
56
|
break;
|
|
31
57
|
}
|
|
@@ -35,7 +61,17 @@ function clientLoggerFactory(config) {
|
|
|
35
61
|
requestParams: JSON.stringify(responseLog.requestParams),
|
|
36
62
|
retryAttempt: responseLog.retryAttempt,
|
|
37
63
|
maxRetries: responseLog.maxRetries,
|
|
38
|
-
response:
|
|
64
|
+
response: responseLog.lastResponse
|
|
65
|
+
? JSON.stringify(serializeResponse(responseLog.lastResponse))
|
|
66
|
+
: 'undefined',
|
|
67
|
+
});
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
case 'HTTP-Response-GraphQL-Deprecation-Notice': {
|
|
71
|
+
const responseLog = logContent.content;
|
|
72
|
+
index.logger(config).debug('Received response containing Deprecated GraphQL Notice', {
|
|
73
|
+
requestParams: JSON.stringify(responseLog.requestParams),
|
|
74
|
+
deprecationNotice: responseLog.deprecationNotice,
|
|
39
75
|
});
|
|
40
76
|
break;
|
|
41
77
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sources":["../../../../../../lib/clients/common.ts"],"sourcesContent":[null],"names":["LIBRARY_NAME","SHOPIFY_API_LIBRARY_VERSION","abstractRuntimeString","logger","ShopifyErrors.HttpRequestError","canonicalizeHeaders","StatusCode","ShopifyErrors.GraphqlQueryError","getHeader","ShopifyErrors.HttpMaxRetriesError","ShopifyErrors.HttpThrottlingError","ShopifyErrors.HttpInternalError","ShopifyErrors.HttpResponseError"],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"common.js","sources":["../../../../../../lib/clients/common.ts"],"sourcesContent":[null],"names":["LIBRARY_NAME","SHOPIFY_API_LIBRARY_VERSION","abstractRuntimeString","logger","ShopifyErrors.HttpRequestError","canonicalizeHeaders","StatusCode","ShopifyErrors.GraphqlQueryError","getHeader","ShopifyErrors.HttpMaxRetriesError","ShopifyErrors.HttpThrottlingError","ShopifyErrors.HttpInternalError","ShopifyErrors.HttpResponseError"],"mappings":";;;;;;;;;;;;AAmBM,SAAU,YAAY,CAAC,MAAuB,EAAA;IAClD,IAAI,eAAe,GAAG,CAAA,EAAGA,kBAAY,CAAA,EAAA,EAAKC,mCAA2B,CAAM,GAAA,EAAAC,mCAAqB,EAAE,CAAA,CAAE;AACpG,IAAA,IAAI,MAAM,CAAC,eAAe,EAAE;QAC1B,eAAe,GAAG,GAAG,MAAM,CAAC,eAAe,CAAM,GAAA,EAAA,eAAe,EAAE;;AAGpE,IAAA,OAAO,eAAe;AACxB;AAEA,SAAS,iBAAiB,CAAC,QAAwB,EAAA;IACjD,IAAI,CAAC,QAAQ,EAAE;AACb,QAAA,OAAO,EAAC,KAAK,EAAE,6BAA6B,EAAC;;AAG/C,IAAA,IAAI;AACF,QAAA,MAAM,EAAC,MAAM,EAAE,UAAU,EAAE,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,OAAO,EAAC,GAAG,QAAQ;AAEzE,QAAA,MAAM,UAAU,GAAQ;YACtB,MAAM;YACN,UAAU;YACV,EAAE;YACF,UAAU;YACV,IAAI;YACJ,GAAG;SACJ;AAED,QAAA,IAAI,OAAO,EAAE,OAAO,EAAE;AACpB,YAAA,UAAU,CAAC,OAAO,GAAG,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;;aACrD,IAAI,OAAO,EAAE;AAClB,YAAA,UAAU,CAAC,OAAO,GAAG,OAAO;;AAG9B,QAAA,OAAO,UAAU;;AACjB,IAAA,MAAM;AACN,QAAA,OAAO,QAAQ;;AAEnB;AAEM,SAAU,mBAAmB,CAAC,MAAuB,EAAA;IACzD,OAAO,CAAC,UAAsB,KAAI;AAChC,QAAA,IAAI,MAA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