@wix/sdk 1.12.10 → 1.12.11

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,5 +1,4 @@
1
- import { isObject } from './helpers.js';
2
- export const isHostModule = (val) => isObject(val) && val.__type === 'host';
1
+ export const isHostModule = (val) => val.__type === 'host';
3
2
  export function buildHostModule(val, host) {
4
3
  return val.create(host);
5
4
  }
@@ -1,8 +1,9 @@
1
1
  import { biHeaderGenerator } from './bi/biHeaderGenerator.js';
2
2
  import { API_URL } from './common.js';
3
+ import { runWithoutContext } from '@wix/sdk-runtime/context';
3
4
  export const getDefaultDomain = (_method, _url) => API_URL;
4
5
  export function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, wixAPIFetch, options) {
5
- return origFunc({
6
+ return runWithoutContext(() => origFunc({
6
7
  request: async (factory) => {
7
8
  const requestOptions = factory({ host: options?.HTTPHost || API_URL });
8
9
  let request = requestOptions;
@@ -57,7 +58,7 @@ export function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, wixAPI
57
58
  },
58
59
  fetchWithAuth: boundFetch,
59
60
  wixAPIFetch,
60
- });
61
+ }));
61
62
  }
62
63
  const errorBuilder = (code, description, details, data) => {
63
64
  return {
@@ -8,6 +8,7 @@ import { buildHostModule, isHostModule } from './host-modules.js';
8
8
  import { buildRESTDescriptor } from './rest-modules.js';
9
9
  import { eventHandlersModules, isEventHandlerModule, } from './event-handlers-modules.js';
10
10
  import { isServicePluginModule, servicePluginsModules, } from './service-plugin-modules.js';
11
+ import { runWithoutContext } from '@wix/sdk-runtime/context';
11
12
  export function createClient(config) {
12
13
  const _headers = config.headers || { Authorization: '' };
13
14
  const authStrategy = config.auth ||
@@ -51,7 +52,7 @@ export function createClient(config) {
51
52
  if ('__type' in modules && modules.__type === SERVICE_PLUGIN_ERROR_TYPE) {
52
53
  return modules;
53
54
  }
54
- const { module, options } = isAmbassadorModule(modules)
55
+ const { module, options } = runWithoutContext(() => isAmbassadorModule(modules))
55
56
  ? {
56
57
  module: toHTTPModule(modules),
57
58
  options: ambassadorModuleOptions(),
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildHostModule = exports.isHostModule = void 0;
4
- const helpers_js_1 = require("./helpers.js");
5
- const isHostModule = (val) => (0, helpers_js_1.isObject)(val) && val.__type === 'host';
4
+ const isHostModule = (val) => val.__type === 'host';
6
5
  exports.isHostModule = isHostModule;
7
6
  function buildHostModule(val, host) {
8
7
  return val.create(host);
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.buildRESTDescriptor = exports.getDefaultDomain = void 0;
4
4
  const biHeaderGenerator_js_1 = require("./bi/biHeaderGenerator.js");
5
5
  const common_js_1 = require("./common.js");
6
+ const context_1 = require("@wix/sdk-runtime/context");
6
7
  const getDefaultDomain = (_method, _url) => common_js_1.API_URL;
7
8
  exports.getDefaultDomain = getDefaultDomain;
8
9
  function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, wixAPIFetch, options) {
9
- return origFunc({
10
+ return (0, context_1.runWithoutContext)(() => origFunc({
10
11
  request: async (factory) => {
11
12
  const requestOptions = factory({ host: options?.HTTPHost || common_js_1.API_URL });
12
13
  let request = requestOptions;
@@ -61,7 +62,7 @@ function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, wixAPIFetch,
61
62
  },
62
63
  fetchWithAuth: boundFetch,
63
64
  wixAPIFetch,
64
- });
65
+ }));
65
66
  }
66
67
  exports.buildRESTDescriptor = buildRESTDescriptor;
67
68
  const errorBuilder = (code, description, details, data) => {
@@ -11,6 +11,7 @@ const host_modules_js_1 = require("./host-modules.js");
11
11
  const rest_modules_js_1 = require("./rest-modules.js");
12
12
  const event_handlers_modules_js_1 = require("./event-handlers-modules.js");
13
13
  const service_plugin_modules_js_1 = require("./service-plugin-modules.js");
14
+ const context_1 = require("@wix/sdk-runtime/context");
14
15
  function createClient(config) {
15
16
  const _headers = config.headers || { Authorization: '' };
16
17
  const authStrategy = config.auth ||
@@ -54,7 +55,7 @@ function createClient(config) {
54
55
  if ('__type' in modules && modules.__type === sdk_types_1.SERVICE_PLUGIN_ERROR_TYPE) {
55
56
  return modules;
56
57
  }
57
- const { module, options } = (0, ambassador_modules_js_1.isAmbassadorModule)(modules)
58
+ const { module, options } = (0, context_1.runWithoutContext)(() => (0, ambassador_modules_js_1.isAmbassadorModule)(modules))
58
59
  ? {
59
60
  module: (0, ambassador_modules_js_1.toHTTPModule)(modules),
60
61
  options: (0, ambassador_modules_js_1.ambassadorModuleOptions)(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/sdk",
3
- "version": "1.12.10",
3
+ "version": "1.12.11",
4
4
  "license": "UNLICENSED",
5
5
  "author": {
6
6
  "name": "Ronny Ringel",
@@ -68,7 +68,7 @@
68
68
  "@wix/image-kit": "^1.78.0",
69
69
  "@wix/redirects": "^1.0.41",
70
70
  "@wix/sdk-context": "^0.0.1",
71
- "@wix/sdk-runtime": "0.3.14",
71
+ "@wix/sdk-runtime": "0.3.15",
72
72
  "@wix/sdk-types": "^1.9.2",
73
73
  "crypto-js": "^4.2.0",
74
74
  "jose": "^5.2.1",
@@ -88,7 +88,7 @@
88
88
  "@wix/events": "^1.0.179",
89
89
  "@wix/metro": "^1.0.73",
90
90
  "@wix/metro-runtime": "^1.1677.0",
91
- "@wix/sdk-runtime": "0.3.14",
91
+ "@wix/sdk-runtime": "0.3.15",
92
92
  "eslint": "^8.56.0",
93
93
  "eslint-config-sdk": "0.0.0",
94
94
  "graphql": "^16.8.0",
@@ -122,5 +122,5 @@
122
122
  "wallaby": {
123
123
  "autoDetect": true
124
124
  },
125
- "falconPackageHash": "b81aa04bef95525c32b389a310367289cfce74217f89f45e72548824"
125
+ "falconPackageHash": "50581ffffc42c024dba24d7ca3d381813b0485255f42bcc8eecbd2a1"
126
126
  }