@wix/sdk 1.15.27 → 1.16.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.
@@ -11,7 +11,7 @@ export function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, errorH
11
11
  let request = requestOptions;
12
12
  if (request.method === 'GET' &&
13
13
  request.fallback?.length &&
14
- request.params.toString().length > 4000) {
14
+ (request.params?.toString().length ?? 0) > 4000) {
15
15
  request = requestOptions.fallback[0];
16
16
  }
17
17
  const domain = options?.HTTPHost ?? DEFAULT_API_URL;
@@ -54,7 +54,17 @@ export function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, errorH
54
54
  });
55
55
  throw error;
56
56
  }
57
- const data = await res.json();
57
+ const rawData = await res.json();
58
+ const data =
59
+ // we only transform the response if the optInTransformResponse flag is set
60
+ // this is for backwards compatibility as some users might rely on not transforming the response
61
+ // in older modules. In that case the modules would not have the optInTransformResponse flag set
62
+ request.migrationOptions?.optInTransformResponse &&
63
+ request.transformResponse
64
+ ? Array.isArray(request.transformResponse)
65
+ ? request.transformResponse[0](rawData)
66
+ : request.transformResponse(rawData)
67
+ : rawData;
58
68
  return {
59
69
  data,
60
70
  headers: res.headers,
@@ -14,7 +14,7 @@ function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, errorHandler,
14
14
  let request = requestOptions;
15
15
  if (request.method === 'GET' &&
16
16
  request.fallback?.length &&
17
- request.params.toString().length > 4000) {
17
+ (request.params?.toString().length ?? 0) > 4000) {
18
18
  request = requestOptions.fallback[0];
19
19
  }
20
20
  const domain = options?.HTTPHost ?? common_js_1.DEFAULT_API_URL;
@@ -57,7 +57,17 @@ function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, errorHandler,
57
57
  });
58
58
  throw error;
59
59
  }
60
- const data = await res.json();
60
+ const rawData = await res.json();
61
+ const data =
62
+ // we only transform the response if the optInTransformResponse flag is set
63
+ // this is for backwards compatibility as some users might rely on not transforming the response
64
+ // in older modules. In that case the modules would not have the optInTransformResponse flag set
65
+ request.migrationOptions?.optInTransformResponse &&
66
+ request.transformResponse
67
+ ? Array.isArray(request.transformResponse)
68
+ ? request.transformResponse[0](rawData)
69
+ : request.transformResponse(rawData)
70
+ : rawData;
61
71
  return {
62
72
  data,
63
73
  headers: res.headers,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/sdk",
3
- "version": "1.15.27",
3
+ "version": "1.16.0",
4
4
  "license": "MIT",
5
5
  "author": {
6
6
  "name": "Ronny Ringel",
@@ -63,7 +63,7 @@
63
63
  },
64
64
  "scripts": {
65
65
  "build": "tsc && tsc --project tsconfig.cjs.json",
66
- "test": "vitest",
66
+ "test": "vitest run",
67
67
  "lint": "eslint --max-warnings=0 .",
68
68
  "lint:fix": "eslint --max-warnings=0 . --fix",
69
69
  "typecheck": "tsc --noEmit"
@@ -73,11 +73,11 @@
73
73
  },
74
74
  "dependencies": {
75
75
  "@wix/identity": "^1.0.104",
76
- "@wix/image-kit": "^1.112.0",
76
+ "@wix/image-kit": "^1.113.0",
77
77
  "@wix/redirects": "^1.0.70",
78
78
  "@wix/sdk-context": "0.0.1",
79
- "@wix/sdk-runtime": "0.3.62",
80
- "@wix/sdk-types": "^1.13.41",
79
+ "@wix/sdk-runtime": "0.4.0",
80
+ "@wix/sdk-types": "1.14.0",
81
81
  "jose": "^5.10.0",
82
82
  "type-fest": "^4.41.0"
83
83
  },
@@ -86,19 +86,19 @@
86
86
  },
87
87
  "devDependencies": {
88
88
  "@types/is-ci": "^3.0.4",
89
- "@types/node": "^20.19.10",
89
+ "@types/node": "^20.19.13",
90
90
  "@vitest/ui": "^1.6.1",
91
91
  "@wix/ecom": "^1.0.886",
92
92
  "@wix/events": "^1.0.382",
93
93
  "@wix/metro": "^1.0.93",
94
94
  "@wix/metro-runtime": "^1.1891.0",
95
- "@wix/sdk-runtime": "0.3.62",
95
+ "@wix/sdk-runtime": "0.4.0",
96
96
  "eslint": "^8.57.1",
97
97
  "eslint-config-sdk": "0.0.0",
98
98
  "graphql": "^16.8.0",
99
99
  "is-ci": "^3.0.1",
100
100
  "jsdom": "^22.1.0",
101
- "msw": "^2.10.4",
101
+ "msw": "^2.11.1",
102
102
  "typescript": "^5.9.2",
103
103
  "vitest": "^1.6.1",
104
104
  "vitest-teamcity-reporter": "^0.3.1"
@@ -126,5 +126,5 @@
126
126
  "wallaby": {
127
127
  "autoDetect": true
128
128
  },
129
- "falconPackageHash": "1c0389f91287fec42f5eb0e61b95c742450981c51f61cbdd6089f828"
129
+ "falconPackageHash": "8d443cdfaea6ed2150d3ee00988a803eda67ca156e2458aa2b380176"
130
130
  }