@wix/api-client
Advanced tools
Comparing version 1.12.4 to 1.12.5
@@ -1,6 +0,5 @@ | ||
import { WixClient } from './wixClient.js'; | ||
import { RESTFunctionDescriptor } from '@wix/sdk-types'; | ||
export declare function elevate<T extends RESTFunctionDescriptor>(restModule: T): T; | ||
export declare const fetchWithAuth: WixClient['fetchWithAuth']; | ||
export declare const graphql: WixClient['graphql']; | ||
export declare const fetchWithAuth: typeof fetch & ((restModuleOpts: import("@wix/sdk-types").HttpClient) => typeof fetch); | ||
export { graphql } from './graphql.js'; | ||
export { setGlobalWixContext } from './wix-context.js'; |
@@ -1,2 +0,1 @@ | ||
import { resolveContext } from '@wix/sdk-runtime/context'; | ||
import { createRESTModule } from '@wix/sdk-runtime/rest-modules'; | ||
@@ -6,16 +5,6 @@ export function elevate(restModule) { | ||
} | ||
export const fetchWithAuth = async (...args) => { | ||
const context = resolveContext(); | ||
if (!context) { | ||
throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules'); | ||
} | ||
return context.fetchWithAuth(...args); | ||
}; | ||
export const graphql = async (...args) => { | ||
const context = resolveContext(); | ||
if (!context) { | ||
throw new Error('Wix context is not available. Make sure to initialize the Wix context before using SDK modules'); | ||
} | ||
return context.graphql(...args); | ||
}; | ||
export const fetchWithAuth = createRESTModule((restModuleOpts) => { | ||
return ((url, options) => restModuleOpts.fetchWithAuth(url, options)); | ||
}); | ||
export { graphql } from './graphql.js'; | ||
export { setGlobalWixContext } from './wix-context.js'; |
@@ -6,2 +6,2 @@ import { BuildRESTFunction, PublicMetadata, RESTFunctionDescriptor } from '@wix/sdk-types'; | ||
export declare const getDefaultDomain: (_method: string, _url: string) => string; | ||
export declare function buildRESTDescriptor<T extends RESTFunctionDescriptor>(origFunc: T, publicMetadata: PublicMetadata, boundFetch: (url: string | URL, init?: RequestInit) => Promise<Response>, options?: RESTModuleOptions): BuildRESTFunction<T>; | ||
export declare function buildRESTDescriptor<T extends RESTFunctionDescriptor>(origFunc: T, publicMetadata: PublicMetadata, boundFetch: typeof fetch, wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>, options?: RESTModuleOptions): BuildRESTFunction<T>; |
import { biHeaderGenerator } from './bi/biHeaderGenerator.js'; | ||
import { API_URL } from './common.js'; | ||
export const getDefaultDomain = (_method, _url) => API_URL; | ||
export function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, options) { | ||
export function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, wixAPIFetch, options) { | ||
return origFunc({ | ||
@@ -59,2 +59,3 @@ request: async (factory) => { | ||
fetchWithAuth: boundFetch, | ||
wixAPIFetch, | ||
}); | ||
@@ -61,0 +62,0 @@ } |
@@ -32,2 +32,5 @@ import { AuthenticationStrategy, BoundAuthenticationStrategy, BuildDescriptors, Descriptors, EventDefinition, EventIdentity, Host, HostModule, RESTFunctionDescriptor, ServicePluginContract, ServicePluginDefinition } from '@wix/sdk-types'; | ||
auth: Omit<Z, 'getAuthHeaders'> & BoundAuthenticationStrategy; | ||
/** | ||
* @deprecated Use `fetchWithAuth` instead | ||
*/ | ||
fetch(relativeUrl: string, options: RequestInit): Promise<Response>; | ||
@@ -34,0 +37,0 @@ fetchWithAuth: typeof fetch; |
@@ -68,3 +68,8 @@ import { wixContext } from '@wix/sdk-context'; | ||
: { module: modules, options: undefined }; | ||
return buildRESTDescriptor(module, metadata ?? {}, boundFetch, options); | ||
return buildRESTDescriptor(module, metadata ?? {}, boundFetch, (relativeUrl, fetchOptions) => { | ||
const finalUrl = new URL(relativeUrl, `https://${API_URL}`); | ||
finalUrl.host = API_URL; | ||
finalUrl.protocol = 'https'; | ||
return boundFetch(finalUrl.toString(), fetchOptions); | ||
}, options); | ||
} | ||
@@ -71,0 +76,0 @@ else if (isObject(modules)) { |
{ | ||
"name": "@wix/api-client", | ||
"version": "1.12.4", | ||
"version": "1.12.5", | ||
"license": "UNLICENSED", | ||
@@ -28,4 +28,4 @@ "main": "build/index.js", | ||
"@wix/sdk-context": "^0.0.1", | ||
"@wix/sdk-runtime": "0.3.9", | ||
"@wix/sdk-types": "^1.9.1", | ||
"@wix/sdk-runtime": "0.3.10", | ||
"@wix/sdk-types": "^1.9.2", | ||
"crypto-js": "^4.2.0", | ||
@@ -39,3 +39,3 @@ "jose": "^5.2.1", | ||
"@wix/metro-runtime": "^1.1677.0", | ||
"@wix/sdk": "1.12.4" | ||
"@wix/sdk": "1.12.5" | ||
}, | ||
@@ -53,3 +53,3 @@ "wix": { | ||
}, | ||
"falconPackageHash": "66ed8fac5eb95fdea2be3ebbabeb540d8f12fb789fd232cd7cbb42a7" | ||
"falconPackageHash": "ba5285cb465e70886596ef3122cdf157b410d721fb8dccaee3efaf83" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
84199
50
2052
+ Added@wix/sdk-runtime@0.3.10(transitive)
- Removed@wix/sdk-runtime@0.3.9(transitive)
Updated@wix/sdk-runtime@0.3.10
Updated@wix/sdk-types@^1.9.2