@kontent-ai/core-sdk 10.12.6 → 10.12.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.
@@ -1 +1 @@
1
- [{"label":"kontent-core.umd.js","isAsset":true,"statSize":172494,"parsedSize":179948,"gzipSize":43710,"groups":[{"label":"lib","path":"./lib","statSize":30643,"groups":[{"label":"helpers","path":"./lib/helpers","statSize":8352,"groups":[{"id":"./lib/helpers/header.helper.ts","label":"header.helper.ts","path":"./lib/helpers/header.helper.ts","statSize":627},{"id":"./lib/helpers/headers-helper.ts","label":"headers-helper.ts","path":"./lib/helpers/headers-helper.ts","statSize":481},{"id":"./lib/helpers/index.ts","label":"index.ts","path":"./lib/helpers/index.ts","statSize":958},{"id":"./lib/helpers/retry-helper.ts","label":"retry-helper.ts","path":"./lib/helpers/retry-helper.ts","statSize":5563},{"id":"./lib/helpers/url.helper.ts","label":"url.helper.ts","path":"./lib/helpers/url.helper.ts","statSize":723}],"parsedSize":0,"gzipSize":0},{"label":"http","path":"./lib/http","statSize":19501,"groups":[{"id":"./lib/http/http.debugger.ts","label":"http.debugger.ts","path":"./lib/http/http.debugger.ts","statSize":513},{"id":"./lib/http/http.functions.ts","label":"http.functions.ts","path":"./lib/http/http.functions.ts","statSize":13995},{"id":"./lib/http/http.models.ts","label":"http.models.ts","path":"./lib/http/http.models.ts","statSize":77},{"id":"./lib/http/http.service.ts","label":"http.service.ts","path":"./lib/http/http.service.ts","statSize":2619},{"id":"./lib/http/ihttp.service.ts","label":"ihttp.service.ts","path":"./lib/http/ihttp.service.ts","statSize":77},{"id":"./lib/http/index.ts","label":"index.ts","path":"./lib/http/index.ts","statSize":1065},{"id":"./lib/http/test-http.service.ts","label":"test-http.service.ts","path":"./lib/http/test-http.service.ts","statSize":1155}],"parsedSize":0,"gzipSize":0},{"id":"./lib/index.ts","label":"index.ts","path":"./lib/index.ts","statSize":905,"parsedSize":179934,"gzipSize":43710},{"label":"models","path":"./lib/models","statSize":1885,"groups":[{"id":"./lib/models/index.ts","label":"index.ts","path":"./lib/models/index.ts","statSize":900},{"id":"./lib/models/isdk-info.ts","label":"isdk-info.ts","path":"./lib/models/isdk-info.ts","statSize":77},{"id":"./lib/models/parameters.ts","label":"parameters.ts","path":"./lib/models/parameters.ts","statSize":831},{"id":"./lib/models/url.models.ts","label":"url.models.ts","path":"./lib/models/url.models.ts","statSize":77}],"parsedSize":0,"gzipSize":0}],"parsedSize":179934,"gzipSize":43710},{"label":"node_modules/axios/dist/browser","path":"./node_modules/axios/dist/browser","statSize":141851,"groups":[{"id":"./node_modules/axios/dist/browser/axios.cjs","label":"axios.cjs","path":"./node_modules/axios/dist/browser/axios.cjs","statSize":141851}],"parsedSize":0,"gzipSize":0}],"isInitialByEntrypoint":{"index":true}}]
1
+ [{"label":"kontent-core.umd.js","isAsset":true,"statSize":176268,"parsedSize":183722,"gzipSize":44672,"groups":[{"label":"lib","path":"./lib","statSize":34417,"groups":[{"label":"helpers","path":"./lib/helpers","statSize":8352,"groups":[{"id":"./lib/helpers/header.helper.ts","label":"header.helper.ts","path":"./lib/helpers/header.helper.ts","statSize":627},{"id":"./lib/helpers/headers-helper.ts","label":"headers-helper.ts","path":"./lib/helpers/headers-helper.ts","statSize":481},{"id":"./lib/helpers/index.ts","label":"index.ts","path":"./lib/helpers/index.ts","statSize":958},{"id":"./lib/helpers/retry-helper.ts","label":"retry-helper.ts","path":"./lib/helpers/retry-helper.ts","statSize":5563},{"id":"./lib/helpers/url.helper.ts","label":"url.helper.ts","path":"./lib/helpers/url.helper.ts","statSize":723}],"parsedSize":0,"gzipSize":0},{"label":"http","path":"./lib/http","statSize":23275,"groups":[{"id":"./lib/http/http.debugger.ts","label":"http.debugger.ts","path":"./lib/http/http.debugger.ts","statSize":513},{"id":"./lib/http/http.functions.ts","label":"http.functions.ts","path":"./lib/http/http.functions.ts","statSize":17769},{"id":"./lib/http/http.models.ts","label":"http.models.ts","path":"./lib/http/http.models.ts","statSize":77},{"id":"./lib/http/http.service.ts","label":"http.service.ts","path":"./lib/http/http.service.ts","statSize":2619},{"id":"./lib/http/ihttp.service.ts","label":"ihttp.service.ts","path":"./lib/http/ihttp.service.ts","statSize":77},{"id":"./lib/http/index.ts","label":"index.ts","path":"./lib/http/index.ts","statSize":1065},{"id":"./lib/http/test-http.service.ts","label":"test-http.service.ts","path":"./lib/http/test-http.service.ts","statSize":1155}],"parsedSize":0,"gzipSize":0},{"id":"./lib/index.ts","label":"index.ts","path":"./lib/index.ts","statSize":905,"parsedSize":183708,"gzipSize":44672},{"label":"models","path":"./lib/models","statSize":1885,"groups":[{"id":"./lib/models/index.ts","label":"index.ts","path":"./lib/models/index.ts","statSize":900},{"id":"./lib/models/isdk-info.ts","label":"isdk-info.ts","path":"./lib/models/isdk-info.ts","statSize":77},{"id":"./lib/models/parameters.ts","label":"parameters.ts","path":"./lib/models/parameters.ts","statSize":831},{"id":"./lib/models/url.models.ts","label":"url.models.ts","path":"./lib/models/url.models.ts","statSize":77}],"parsedSize":0,"gzipSize":0}],"parsedSize":183708,"gzipSize":44672},{"label":"node_modules/axios/dist/browser","path":"./node_modules/axios/dist/browser","statSize":141851,"groups":[{"id":"./node_modules/axios/dist/browser/axios.cjs","label":"axios.cjs","path":"./node_modules/axios/dist/browser/axios.cjs","statSize":141851}],"parsedSize":0,"gzipSize":0}],"isInitialByEntrypoint":{"index":true}}]
@@ -1 +1 @@
1
- [{"label":"kontent-core.umd.min.js","isAsset":true,"statSize":172494,"parsedSize":59839,"gzipSize":19574,"groups":[{"label":"lib","path":"./lib","statSize":30643,"groups":[{"label":"helpers","path":"./lib/helpers","statSize":8352,"groups":[{"id":954,"label":"header.helper.ts","path":"./lib/helpers/header.helper.ts","statSize":627},{"id":482,"label":"headers-helper.ts","path":"./lib/helpers/headers-helper.ts","statSize":481},{"id":191,"label":"index.ts","path":"./lib/helpers/index.ts","statSize":958},{"id":722,"label":"retry-helper.ts","path":"./lib/helpers/retry-helper.ts","statSize":5563},{"id":314,"label":"url.helper.ts","path":"./lib/helpers/url.helper.ts","statSize":723}],"parsedSize":0,"gzipSize":0},{"label":"http","path":"./lib/http","statSize":19501,"groups":[{"id":915,"label":"http.debugger.ts","path":"./lib/http/http.debugger.ts","statSize":513},{"id":347,"label":"http.functions.ts","path":"./lib/http/http.functions.ts","statSize":13995},{"id":414,"label":"http.models.ts","path":"./lib/http/http.models.ts","statSize":77},{"id":25,"label":"http.service.ts","path":"./lib/http/http.service.ts","statSize":2619},{"id":148,"label":"ihttp.service.ts","path":"./lib/http/ihttp.service.ts","statSize":77},{"id":562,"label":"index.ts","path":"./lib/http/index.ts","statSize":1065},{"id":216,"label":"test-http.service.ts","path":"./lib/http/test-http.service.ts","statSize":1155}],"parsedSize":0,"gzipSize":0},{"id":245,"label":"index.ts","path":"./lib/index.ts","statSize":905,"parsedSize":59839,"gzipSize":19574},{"label":"models","path":"./lib/models","statSize":1885,"groups":[{"id":492,"label":"index.ts","path":"./lib/models/index.ts","statSize":900},{"id":860,"label":"isdk-info.ts","path":"./lib/models/isdk-info.ts","statSize":77},{"id":958,"label":"parameters.ts","path":"./lib/models/parameters.ts","statSize":831},{"id":133,"label":"url.models.ts","path":"./lib/models/url.models.ts","statSize":77}],"parsedSize":0,"gzipSize":0}],"parsedSize":59839,"gzipSize":19574},{"label":"node_modules/axios/dist/browser","path":"./node_modules/axios/dist/browser","statSize":141851,"groups":[{"id":425,"label":"axios.cjs","path":"./node_modules/axios/dist/browser/axios.cjs","statSize":141851}],"parsedSize":0,"gzipSize":0}],"isInitialByEntrypoint":{"index":true}}]
1
+ [{"label":"kontent-core.umd.min.js","isAsset":true,"statSize":176268,"parsedSize":60789,"gzipSize":19797,"groups":[{"label":"lib","path":"./lib","statSize":34417,"groups":[{"label":"helpers","path":"./lib/helpers","statSize":8352,"groups":[{"id":954,"label":"header.helper.ts","path":"./lib/helpers/header.helper.ts","statSize":627},{"id":482,"label":"headers-helper.ts","path":"./lib/helpers/headers-helper.ts","statSize":481},{"id":191,"label":"index.ts","path":"./lib/helpers/index.ts","statSize":958},{"id":722,"label":"retry-helper.ts","path":"./lib/helpers/retry-helper.ts","statSize":5563},{"id":314,"label":"url.helper.ts","path":"./lib/helpers/url.helper.ts","statSize":723}],"parsedSize":0,"gzipSize":0},{"label":"http","path":"./lib/http","statSize":23275,"groups":[{"id":915,"label":"http.debugger.ts","path":"./lib/http/http.debugger.ts","statSize":513},{"id":347,"label":"http.functions.ts","path":"./lib/http/http.functions.ts","statSize":17769},{"id":414,"label":"http.models.ts","path":"./lib/http/http.models.ts","statSize":77},{"id":25,"label":"http.service.ts","path":"./lib/http/http.service.ts","statSize":2619},{"id":148,"label":"ihttp.service.ts","path":"./lib/http/ihttp.service.ts","statSize":77},{"id":562,"label":"index.ts","path":"./lib/http/index.ts","statSize":1065},{"id":216,"label":"test-http.service.ts","path":"./lib/http/test-http.service.ts","statSize":1155}],"parsedSize":0,"gzipSize":0},{"id":245,"label":"index.ts","path":"./lib/index.ts","statSize":905,"parsedSize":60789,"gzipSize":19797},{"label":"models","path":"./lib/models","statSize":1885,"groups":[{"id":492,"label":"index.ts","path":"./lib/models/index.ts","statSize":900},{"id":860,"label":"isdk-info.ts","path":"./lib/models/isdk-info.ts","statSize":77},{"id":958,"label":"parameters.ts","path":"./lib/models/parameters.ts","statSize":831},{"id":133,"label":"url.models.ts","path":"./lib/models/url.models.ts","statSize":77}],"parsedSize":0,"gzipSize":0}],"parsedSize":60789,"gzipSize":19797},{"label":"node_modules/axios/dist/browser","path":"./node_modules/axios/dist/browser","statSize":141851,"groups":[{"id":425,"label":"axios.cjs","path":"./node_modules/axios/dist/browser/axios.cjs","statSize":141851}],"parsedSize":0,"gzipSize":0}],"isInitialByEntrypoint":{"index":true}}]
@@ -1,8 +1,8 @@
1
1
  {
2
- "hash": "8b9006e092b44484ad76",
2
+ "hash": "5d2a5a1d5fae1f94c35a",
3
3
  "version": "5.106.1",
4
- "time": 555,
5
- "builtAt": 1783062295633,
4
+ "time": 606,
5
+ "builtAt": 1784546975792,
6
6
  "publicPath": "auto",
7
7
  "outputPath": "/Users/richards/dev/core-sdk-js/dist/umd",
8
8
  "assetsByChunkName": {
@@ -15,7 +15,7 @@
15
15
  {
16
16
  "type": "asset",
17
17
  "name": "kontent-core.umd.js",
18
- "size": 179948,
18
+ "size": 183722,
19
19
  "emitted": true,
20
20
  "comparedForEmit": false,
21
21
  "cached": false,
@@ -24,7 +24,7 @@
24
24
  "related": {
25
25
  "sourceMap": "kontent-core.umd.js.map"
26
26
  },
27
- "size": 179948
27
+ "size": 183722
28
28
  },
29
29
  "chunkNames": [
30
30
  "index"
@@ -37,13 +37,13 @@
37
37
  {
38
38
  "type": "sourceMap",
39
39
  "name": "kontent-core.umd.js.map",
40
- "size": 222598,
40
+ "size": 228512,
41
41
  "emitted": true,
42
42
  "comparedForEmit": false,
43
43
  "cached": false,
44
44
  "info": {
45
45
  "development": true,
46
- "size": 222598
46
+ "size": 228512
47
47
  },
48
48
  "chunkNames": [],
49
49
  "chunkIdHints": [],
@@ -72,9 +72,9 @@
72
72
  "initial": true,
73
73
  "entry": true,
74
74
  "recorded": false,
75
- "size": 172715,
75
+ "size": 176489,
76
76
  "sizes": {
77
- "javascript": 172494,
77
+ "javascript": 176268,
78
78
  "runtime": 221
79
79
  },
80
80
  "names": [
@@ -90,7 +90,7 @@
90
90
  "auxiliaryFiles": [
91
91
  "kontent-core.umd.js.map"
92
92
  ],
93
- "hash": "6c8b60d14274e4cd60a7",
93
+ "hash": "06181a677439c759710d",
94
94
  "childrenByOrder": {},
95
95
  "id": "index",
96
96
  "siblings": [],
@@ -692,9 +692,9 @@
692
692
  "type": "module",
693
693
  "moduleType": "javascript/auto",
694
694
  "layer": null,
695
- "size": 13995,
695
+ "size": 17769,
696
696
  "sizes": {
697
- "javascript": 13995
697
+ "javascript": 17769
698
698
  },
699
699
  "built": true,
700
700
  "codeGenerated": true,
@@ -3434,9 +3434,9 @@
3434
3434
  "type": "module",
3435
3435
  "moduleType": "javascript/auto",
3436
3436
  "layer": null,
3437
- "size": 13995,
3437
+ "size": 17769,
3438
3438
  "sizes": {
3439
- "javascript": 13995
3439
+ "javascript": 17769
3440
3440
  },
3441
3441
  "built": true,
3442
3442
  "codeGenerated": true,
@@ -3907,19 +3907,19 @@
3907
3907
  "assets": [
3908
3908
  {
3909
3909
  "name": "kontent-core.umd.js",
3910
- "size": 179948
3910
+ "size": 183722
3911
3911
  }
3912
3912
  ],
3913
3913
  "filteredAssets": 0,
3914
- "assetsSize": 179948,
3914
+ "assetsSize": 183722,
3915
3915
  "auxiliaryAssets": [
3916
3916
  {
3917
3917
  "name": "kontent-core.umd.js.map",
3918
- "size": 222598
3918
+ "size": 228512
3919
3919
  }
3920
3920
  ],
3921
3921
  "filteredAuxiliaryAssets": 0,
3922
- "auxiliaryAssetsSize": 222598,
3922
+ "auxiliaryAssetsSize": 228512,
3923
3923
  "children": {},
3924
3924
  "childAssets": {},
3925
3925
  "isOverSizeLimit": false
@@ -3934,19 +3934,19 @@
3934
3934
  "assets": [
3935
3935
  {
3936
3936
  "name": "kontent-core.umd.js",
3937
- "size": 179948
3937
+ "size": 183722
3938
3938
  }
3939
3939
  ],
3940
3940
  "filteredAssets": 0,
3941
- "assetsSize": 179948,
3941
+ "assetsSize": 183722,
3942
3942
  "auxiliaryAssets": [
3943
3943
  {
3944
3944
  "name": "kontent-core.umd.js.map",
3945
- "size": 222598
3945
+ "size": 228512
3946
3946
  }
3947
3947
  ],
3948
3948
  "filteredAuxiliaryAssets": 0,
3949
- "auxiliaryAssetsSize": 222598,
3949
+ "auxiliaryAssetsSize": 228512,
3950
3950
  "children": {},
3951
3951
  "childAssets": {},
3952
3952
  "isOverSizeLimit": false
@@ -1,8 +1,8 @@
1
1
  {
2
- "hash": "13f9c4430949ff28f0d6",
2
+ "hash": "ca182fd3aa10e4f84024",
3
3
  "version": "5.106.1",
4
- "time": 778,
5
- "builtAt": 1783062296862,
4
+ "time": 984,
5
+ "builtAt": 1784546977269,
6
6
  "publicPath": "auto",
7
7
  "outputPath": "/Users/richards/dev/core-sdk-js/dist/umd",
8
8
  "assetsByChunkName": {
@@ -15,7 +15,7 @@
15
15
  {
16
16
  "type": "asset",
17
17
  "name": "kontent-core.umd.min.js",
18
- "size": 59839,
18
+ "size": 60789,
19
19
  "emitted": true,
20
20
  "comparedForEmit": false,
21
21
  "cached": false,
@@ -26,7 +26,7 @@
26
26
  "license": "kontent-core.umd.min.js.LICENSE.txt",
27
27
  "sourceMap": "kontent-core.umd.min.js.map"
28
28
  },
29
- "size": 59839
29
+ "size": 60789
30
30
  },
31
31
  "chunkNames": [
32
32
  "index"
@@ -39,13 +39,13 @@
39
39
  {
40
40
  "type": "sourceMap",
41
41
  "name": "kontent-core.umd.min.js.map",
42
- "size": 254261,
42
+ "size": 259392,
43
43
  "emitted": true,
44
44
  "comparedForEmit": false,
45
45
  "cached": false,
46
46
  "info": {
47
47
  "development": true,
48
- "size": 254261
48
+ "size": 259392
49
49
  },
50
50
  "chunkNames": [],
51
51
  "chunkIdHints": [],
@@ -94,9 +94,9 @@
94
94
  "initial": true,
95
95
  "entry": true,
96
96
  "recorded": false,
97
- "size": 172715,
97
+ "size": 176489,
98
98
  "sizes": {
99
- "javascript": 172494,
99
+ "javascript": 176268,
100
100
  "runtime": 221
101
101
  },
102
102
  "names": [
@@ -112,7 +112,7 @@
112
112
  "auxiliaryFiles": [
113
113
  "kontent-core.umd.min.js.map"
114
114
  ],
115
- "hash": "fd6d05eedaa18bf97738",
115
+ "hash": "38ffcc141d37f362056e",
116
116
  "childrenByOrder": {},
117
117
  "id": 57,
118
118
  "siblings": [],
@@ -731,9 +731,9 @@
731
731
  "type": "module",
732
732
  "moduleType": "javascript/auto",
733
733
  "layer": null,
734
- "size": 13995,
734
+ "size": 17769,
735
735
  "sizes": {
736
- "javascript": 13995
736
+ "javascript": 17769
737
737
  },
738
738
  "built": true,
739
739
  "codeGenerated": true,
@@ -3537,9 +3537,9 @@
3537
3537
  "type": "module",
3538
3538
  "moduleType": "javascript/auto",
3539
3539
  "layer": null,
3540
- "size": 13995,
3540
+ "size": 17769,
3541
3541
  "sizes": {
3542
- "javascript": 13995
3542
+ "javascript": 17769
3543
3543
  },
3544
3544
  "built": true,
3545
3545
  "codeGenerated": true,
@@ -4023,19 +4023,19 @@
4023
4023
  "assets": [
4024
4024
  {
4025
4025
  "name": "kontent-core.umd.min.js",
4026
- "size": 59839
4026
+ "size": 60789
4027
4027
  }
4028
4028
  ],
4029
4029
  "filteredAssets": 0,
4030
- "assetsSize": 59839,
4030
+ "assetsSize": 60789,
4031
4031
  "auxiliaryAssets": [
4032
4032
  {
4033
4033
  "name": "kontent-core.umd.min.js.map",
4034
- "size": 254261
4034
+ "size": 259392
4035
4035
  }
4036
4036
  ],
4037
4037
  "filteredAuxiliaryAssets": 0,
4038
- "auxiliaryAssetsSize": 254261,
4038
+ "auxiliaryAssetsSize": 259392,
4039
4039
  "children": {},
4040
4040
  "childAssets": {},
4041
4041
  "isOverSizeLimit": false
@@ -4050,19 +4050,19 @@
4050
4050
  "assets": [
4051
4051
  {
4052
4052
  "name": "kontent-core.umd.min.js",
4053
- "size": 59839
4053
+ "size": 60789
4054
4054
  }
4055
4055
  ],
4056
4056
  "filteredAssets": 0,
4057
- "assetsSize": 59839,
4057
+ "assetsSize": 60789,
4058
4058
  "auxiliaryAssets": [
4059
4059
  {
4060
4060
  "name": "kontent-core.umd.min.js.map",
4061
- "size": 254261
4061
+ "size": 259392
4062
4062
  }
4063
4063
  ],
4064
4064
  "filteredAuxiliaryAssets": 0,
4065
- "auxiliaryAssetsSize": 254261,
4065
+ "auxiliaryAssetsSize": 259392,
4066
4066
  "children": {},
4067
4067
  "childAssets": {},
4068
4068
  "isOverSizeLimit": false
@@ -33,6 +33,7 @@ export async function getWithRetryAsync<TRawData>(
33
33
  url: call.url,
34
34
  retryStrategy: retryStrategyOptions,
35
35
  functionsConfig: functionsConfig,
36
+ headers: options?.headers ?? [],
36
37
  call: async (retryAttempt) => {
37
38
  httpDebugger.debugStartHttpRequest();
38
39
 
@@ -72,6 +73,7 @@ export async function postWithRetryAsync<TRawData>(
72
73
  url: call.url,
73
74
  retryStrategy: retryStrategyOptions,
74
75
  functionsConfig: functionsConfig,
76
+ headers: options?.headers ?? [],
75
77
  call: async (retryAttempt) => {
76
78
  httpDebugger.debugStartHttpRequest();
77
79
 
@@ -115,6 +117,7 @@ export async function putWithRetryAsync<TRawData>(
115
117
  url: call.url,
116
118
  retryStrategy: retryStrategyOptions,
117
119
  functionsConfig: functionsConfig,
120
+ headers: options?.headers ?? [],
118
121
  call: async (retryAttempt) => {
119
122
  httpDebugger.debugStartHttpRequest();
120
123
 
@@ -158,6 +161,7 @@ export async function patchWithRetryAsync<TRawData>(
158
161
  url: call.url,
159
162
  retryStrategy: retryStrategyOptions,
160
163
  functionsConfig: functionsConfig,
164
+ headers: options?.headers ?? [],
161
165
  call: async (retryAttempt) => {
162
166
  httpDebugger.debugStartHttpRequest();
163
167
 
@@ -201,6 +205,7 @@ export async function deleteWithRetryAsync<TRawData>(
201
205
  url: call.url,
202
206
  retryStrategy: retryStrategyOptions,
203
207
  functionsConfig: functionsConfig,
208
+ headers: options?.headers ?? [],
204
209
  call: async (retryAttempt) => {
205
210
  httpDebugger.debugStartHttpRequest();
206
211
 
@@ -252,6 +257,7 @@ async function runWithRetryAsync<TRawData>(data: {
252
257
  call: (retryAttempt: number) => Promise<IResponse<TRawData>>;
253
258
  retryStrategy: IRetryStrategyOptions;
254
259
  functionsConfig: IHttpFunctionsConfig;
260
+ headers: IHeader[];
255
261
  }): Promise<IResponse<TRawData>> {
256
262
  try {
257
263
  return await data.call(data.retryAttempt);
@@ -282,16 +288,112 @@ async function runWithRetryAsync<TRawData>(data: {
282
288
  retryStrategy: data.retryStrategy,
283
289
  retryAttempt: data.retryAttempt + 1,
284
290
  url: data.url,
285
- functionsConfig: data.functionsConfig
291
+ functionsConfig: data.functionsConfig,
292
+ headers: data.headers
286
293
  });
287
294
  }
288
295
 
296
+ // sanitize the error before logging / re-throwing so the authorization token is not leaked
297
+ const sanitizedError = sanitizeError(error, data.headers);
298
+
289
299
  if (data.functionsConfig.logErrorsToConsole) {
290
- console.error(`Executing '${data.url}' failed. Request was retried '${data.retryAttempt}' times. `, error);
300
+ console.error(
301
+ `Executing '${data.url}' failed. Request was retried '${data.retryAttempt}' times.`,
302
+ sanitizedError
303
+ );
291
304
  }
292
305
 
293
- throw error;
306
+ throw sanitizedError;
307
+ }
308
+ }
309
+
310
+ const redactedValue = 'redacted';
311
+ const maxRedactionDepth = 10;
312
+
313
+ /**
314
+ * Returns the caller-supplied 'authorization' header value(s), which are the secret token(s) to
315
+ * scrub from errors. Note: if a consumer sets the authorization token on the axios instance defaults
316
+ * instead of passing it via 'options.headers', it is not known here and cannot be redacted.
317
+ */
318
+ function getSecretHeaderValues(headers: IHeader[]): string[] {
319
+ return headers
320
+ .filter((header) => header.header.toLowerCase() === 'authorization')
321
+ .map((header) => header.value)
322
+ // skip empty values - splitting on an empty string would corrupt every string
323
+ .filter((value) => typeof value === 'string' && value.length > 0);
324
+ }
325
+
326
+ function redactStringValue(value: string, secrets: string[]): string {
327
+ let result = value;
328
+
329
+ for (const secret of secrets) {
330
+ if (result.includes(secret)) {
331
+ result = result.split(secret).join(redactedValue);
332
+ }
294
333
  }
334
+
335
+ return result;
336
+ }
337
+
338
+ /**
339
+ * Walks the object graph (cycle- and depth-guarded) replacing every occurrence of a secret with the
340
+ * redacted placeholder in place.
341
+ */
342
+ function redactSecretsInPlace(target: unknown, secrets: string[], seen: WeakSet<object>, depth: number): void {
343
+ if (depth > maxRedactionDepth || target === null || typeof target !== 'object') {
344
+ return;
345
+ }
346
+
347
+ if (seen.has(target)) {
348
+ // break cycles (config.headers, request.socket, response.request, ...)
349
+ return;
350
+ }
351
+ seen.add(target);
352
+
353
+ for (const key of Object.keys(target as Record<string, unknown>)) {
354
+ let value: unknown;
355
+
356
+ try {
357
+ value = (target as Record<string, unknown>)[key];
358
+ } catch {
359
+ // accessing the property threw (e.g. a getter) - skip it
360
+ continue;
361
+ }
362
+
363
+ if (typeof value === 'string') {
364
+ const redacted = redactStringValue(value, secrets);
365
+
366
+ if (redacted !== value) {
367
+ try {
368
+ (target as Record<string, unknown>)[key] = redacted;
369
+ } catch {
370
+ // property is read-only - skip it
371
+ }
372
+ }
373
+ } else if (value && typeof value === 'object') {
374
+ redactSecretsInPlace(value, secrets, seen, depth + 1);
375
+ }
376
+ }
377
+ }
378
+
379
+ /**
380
+ * If 'error' is an axios error, redacts every occurrence of the caller's authorization token (taken
381
+ * from 'headers') throughout the error, replacing it with a redacted placeholder. Non-axios errors
382
+ * and errors with no known token are returned unchanged. This prevents the authorization token from
383
+ * leaking via console logs or the re-thrown error. All other axios properties are preserved.
384
+ */
385
+ function sanitizeError(error: unknown, headers: IHeader[]): unknown {
386
+ if (!axios.isAxiosError(error)) {
387
+ return error;
388
+ }
389
+
390
+ const secrets = getSecretHeaderValues(headers);
391
+ if (secrets.length === 0) {
392
+ return error;
393
+ }
394
+
395
+ redactSecretsInPlace(error, secrets, new WeakSet<object>(), 0);
396
+ return error;
295
397
  }
296
398
 
297
399
  function getHeadersJson(headers: IHeader[], addContentTypeHeader: boolean): { [header: string]: string } {
@@ -2,6 +2,6 @@
2
2
  import { ISDKInfo } from '.';
3
3
  export const sdkInfo: ISDKInfo = {
4
4
  host: 'npmjs.com',
5
- version: '10.12.6',
5
+ version: '10.12.7',
6
6
  name: '@kontent-ai/core-sdk'
7
7
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontent-ai/core-sdk",
3
- "version": "10.12.6",
3
+ "version": "10.12.7",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/kontent-ai/kontent-core-js"