@wix/sdk 1.4.0 → 1.4.1

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.
@@ -107,6 +107,7 @@ function objectToKeyValue(input) {
107
107
  }
108
108
 
109
109
  // src/rest-modules.ts
110
+ var getDefaultDomain = (method, url) => method === "GET" && !FORCE_WRITE_API_URLS.some((write_url) => url === write_url) ? READ_ONLY_API_URL : API_URL;
110
111
  function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, options) {
111
112
  return origFunc({
112
113
  request: async (factory) => {
@@ -116,8 +117,7 @@ function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, options) {
116
117
  if (request.method === "GET" && ((_a = request.fallback) == null ? void 0 : _a.length) && request.params.toString().length > 4e3) {
117
118
  request = requestOptions.fallback[0];
118
119
  }
119
- const getDefaultDomain = () => request.method === "GET" && !FORCE_WRITE_API_URLS.some((url2) => request.url === url2) ? READ_ONLY_API_URL : API_URL;
120
- const domain = (_b = options == null ? void 0 : options.HTTPHost) != null ? _b : getDefaultDomain();
120
+ const domain = (_b = options == null ? void 0 : options.HTTPHost) != null ? _b : getDefaultDomain(request.method, request.url);
121
121
  let url = `https://${domain}${request.url}`;
122
122
  if (request.params && request.params.toString()) {
123
123
  url += `?${request.params.toString()}`;
@@ -913,5 +913,6 @@ export {
913
913
  WixAppOAuthStrategy,
914
914
  createClient,
915
915
  decodeText,
916
+ getDefaultDomain,
916
917
  media
917
918
  };
package/build/index.d.mts CHANGED
@@ -9,6 +9,8 @@ type PublicMetadata = {
9
9
  };
10
10
  declare const API_URL = "www.wixapis.com";
11
11
 
12
+ declare const getDefaultDomain: (method: string, url: string) => "www.wixapis.com" | "readonly.wixapis.com";
13
+
12
14
  type RequestContext = {
13
15
  isSSR: boolean;
14
16
  host: string;
@@ -307,4 +309,4 @@ declare function WixAppOAuthStrategy(opts: {
307
309
  refreshToken?: string;
308
310
  }): WixAppOAuthStrategy;
309
311
 
310
- export { API_URL, AccessToken, ApiKeyStrategy, AssertHostMatches, BuildDescriptors, CalculateNextState, Descriptors, IApiKeyStrategy, IOAuthStrategy, LoginParams, LoginState, OAuthStrategy, OauthData, OauthPKCE, ProcessableState, RefreshToken, RegisterParams, StateMachine, Token, TokenResponse, TokenRole, Tokens, WixAppOAuthStrategy, WixClient, createClient, decodeText, media };
312
+ export { API_URL, AccessToken, ApiKeyStrategy, AssertHostMatches, BuildDescriptors, CalculateNextState, Descriptors, IApiKeyStrategy, IOAuthStrategy, LoginParams, LoginState, OAuthStrategy, OauthData, OauthPKCE, ProcessableState, RefreshToken, RegisterParams, StateMachine, Token, TokenResponse, TokenRole, Tokens, WixAppOAuthStrategy, WixClient, createClient, decodeText, getDefaultDomain, media };
package/build/index.d.ts CHANGED
@@ -9,6 +9,8 @@ type PublicMetadata = {
9
9
  };
10
10
  declare const API_URL = "www.wixapis.com";
11
11
 
12
+ declare const getDefaultDomain: (method: string, url: string) => "www.wixapis.com" | "readonly.wixapis.com";
13
+
12
14
  type RequestContext = {
13
15
  isSSR: boolean;
14
16
  host: string;
@@ -307,4 +309,4 @@ declare function WixAppOAuthStrategy(opts: {
307
309
  refreshToken?: string;
308
310
  }): WixAppOAuthStrategy;
309
311
 
310
- export { API_URL, AccessToken, ApiKeyStrategy, AssertHostMatches, BuildDescriptors, CalculateNextState, Descriptors, IApiKeyStrategy, IOAuthStrategy, LoginParams, LoginState, OAuthStrategy, OauthData, OauthPKCE, ProcessableState, RefreshToken, RegisterParams, StateMachine, Token, TokenResponse, TokenRole, Tokens, WixAppOAuthStrategy, WixClient, createClient, decodeText, media };
312
+ export { API_URL, AccessToken, ApiKeyStrategy, AssertHostMatches, BuildDescriptors, CalculateNextState, Descriptors, IApiKeyStrategy, IOAuthStrategy, LoginParams, LoginState, OAuthStrategy, OauthData, OauthPKCE, ProcessableState, RefreshToken, RegisterParams, StateMachine, Token, TokenResponse, TokenRole, Tokens, WixAppOAuthStrategy, WixClient, createClient, decodeText, getDefaultDomain, media };
package/build/index.js CHANGED
@@ -39,6 +39,7 @@ __export(src_exports, {
39
39
  WixAppOAuthStrategy: () => WixAppOAuthStrategy,
40
40
  createClient: () => createClient,
41
41
  decodeText: () => decodeText,
42
+ getDefaultDomain: () => getDefaultDomain,
42
43
  media: () => media
43
44
  });
44
45
  module.exports = __toCommonJS(src_exports);
@@ -151,6 +152,7 @@ function objectToKeyValue(input) {
151
152
  }
152
153
 
153
154
  // src/rest-modules.ts
155
+ var getDefaultDomain = (method, url) => method === "GET" && !FORCE_WRITE_API_URLS.some((write_url) => url === write_url) ? READ_ONLY_API_URL : API_URL;
154
156
  function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, options) {
155
157
  return origFunc({
156
158
  request: async (factory) => {
@@ -159,8 +161,7 @@ function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, options) {
159
161
  if (request.method === "GET" && request.fallback?.length && request.params.toString().length > 4e3) {
160
162
  request = requestOptions.fallback[0];
161
163
  }
162
- const getDefaultDomain = () => request.method === "GET" && !FORCE_WRITE_API_URLS.some((url2) => request.url === url2) ? READ_ONLY_API_URL : API_URL;
163
- const domain = options?.HTTPHost ?? getDefaultDomain();
164
+ const domain = options?.HTTPHost ?? getDefaultDomain(request.method, request.url);
164
165
  let url = `https://${domain}${request.url}`;
165
166
  if (request.params && request.params.toString()) {
166
167
  url += `?${request.params.toString()}`;
@@ -950,6 +951,7 @@ __reExport(src_exports, require("@wix/sdk-types"), module.exports);
950
951
  WixAppOAuthStrategy,
951
952
  createClient,
952
953
  decodeText,
954
+ getDefaultDomain,
953
955
  media,
954
956
  ...require("@wix/sdk-types")
955
957
  });
package/build/index.mjs CHANGED
@@ -106,6 +106,7 @@ function objectToKeyValue(input) {
106
106
  }
107
107
 
108
108
  // src/rest-modules.ts
109
+ var getDefaultDomain = (method, url) => method === "GET" && !FORCE_WRITE_API_URLS.some((write_url) => url === write_url) ? READ_ONLY_API_URL : API_URL;
109
110
  function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, options) {
110
111
  return origFunc({
111
112
  request: async (factory) => {
@@ -114,8 +115,7 @@ function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, options) {
114
115
  if (request.method === "GET" && request.fallback?.length && request.params.toString().length > 4e3) {
115
116
  request = requestOptions.fallback[0];
116
117
  }
117
- const getDefaultDomain = () => request.method === "GET" && !FORCE_WRITE_API_URLS.some((url2) => request.url === url2) ? READ_ONLY_API_URL : API_URL;
118
- const domain = options?.HTTPHost ?? getDefaultDomain();
118
+ const domain = options?.HTTPHost ?? getDefaultDomain(request.method, request.url);
119
119
  let url = `https://${domain}${request.url}`;
120
120
  if (request.params && request.params.toString()) {
121
121
  url += `?${request.params.toString()}`;
@@ -904,5 +904,6 @@ export {
904
904
  WixAppOAuthStrategy,
905
905
  createClient,
906
906
  decodeText,
907
+ getDefaultDomain,
907
908
  media
908
909
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/sdk",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "license": "UNLICENSED",
5
5
  "author": {
6
6
  "name": "Ronny Ringel",
@@ -31,9 +31,9 @@
31
31
  },
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.22.15",
34
- "@wix/identity": "^1.0.56",
34
+ "@wix/identity": "^1.0.57",
35
35
  "@wix/image-kit": "^1.37.0",
36
- "@wix/metro-runtime": "^1.1528.0",
36
+ "@wix/metro-runtime": "^1.1529.0",
37
37
  "@wix/redirects": "^1.0.24",
38
38
  "@wix/sdk-types": "1.4.0",
39
39
  "pkce-challenge": "^3.1.0",
@@ -46,7 +46,7 @@
46
46
  "@types/jest": "^27.5.2",
47
47
  "@types/node": "^16.18.50",
48
48
  "@types/node-fetch": "^2.6.4",
49
- "@wix/ecom": "^1.0.350",
49
+ "@wix/ecom": "^1.0.351",
50
50
  "@wix/events": "^1.0.117",
51
51
  "@wix/metro": "^1.0.67",
52
52
  "eslint": "^7.32.0",
@@ -83,5 +83,5 @@
83
83
  "wallaby": {
84
84
  "autoDetect": true
85
85
  },
86
- "falconPackageHash": "e29cd59910eaf06e19edd72d4a7e2cfb431c4a4e6ebb29eeff606342"
86
+ "falconPackageHash": "9b6b240d14e5fef75a1df39838bcd3c97317d7c97d86f43073bb4306"
87
87
  }