@wix/sdk 1.12.13 → 1.13.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.
- package/build/auth/AppStrategy.js +3 -0
- package/build/rest-modules.d.ts +1 -1
- package/build/rest-modules.js +2 -1
- package/build/wixClient.js +8 -1
- package/cjs/build/auth/AppStrategy.js +3 -0
- package/cjs/build/rest-modules.d.ts +1 -1
- package/cjs/build/rest-modules.js +2 -1
- package/cjs/build/wixClient.js +8 -1
- package/package.json +6 -6
|
@@ -207,6 +207,9 @@ export function AppStrategy(opts) {
|
|
|
207
207
|
}
|
|
208
208
|
return getTokenInfo(tokenToCheck, authServerBaseUrl);
|
|
209
209
|
},
|
|
210
|
+
getActiveToken() {
|
|
211
|
+
return 'accessToken' in opts ? opts.accessToken : refreshToken;
|
|
212
|
+
},
|
|
210
213
|
};
|
|
211
214
|
}
|
|
212
215
|
async function getTokenInfo(token, authServerBaseUrl) {
|
package/build/rest-modules.d.ts
CHANGED
|
@@ -2,4 +2,4 @@ import { BuildRESTFunction, PublicMetadata, RESTFunctionDescriptor } from '@wix/
|
|
|
2
2
|
export type RESTModuleOptions = {
|
|
3
3
|
HTTPHost?: string;
|
|
4
4
|
};
|
|
5
|
-
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>;
|
|
5
|
+
export declare function buildRESTDescriptor<T extends RESTFunctionDescriptor>(origFunc: T, publicMetadata: PublicMetadata, boundFetch: typeof fetch, wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>, getActiveToken?: () => string | undefined, options?: RESTModuleOptions): BuildRESTFunction<T>;
|
package/build/rest-modules.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { biHeaderGenerator } from './bi/biHeaderGenerator.js';
|
|
2
2
|
import { DEFAULT_API_URL } from './common.js';
|
|
3
3
|
import { runWithoutContext } from '@wix/sdk-runtime/context';
|
|
4
|
-
export function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, wixAPIFetch, options) {
|
|
4
|
+
export function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, wixAPIFetch, getActiveToken, options) {
|
|
5
5
|
return runWithoutContext(() => origFunc({
|
|
6
6
|
request: async (factory) => {
|
|
7
7
|
const requestOptions = factory({
|
|
@@ -59,6 +59,7 @@ export function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, wixAPI
|
|
|
59
59
|
},
|
|
60
60
|
fetchWithAuth: boundFetch,
|
|
61
61
|
wixAPIFetch,
|
|
62
|
+
getActiveToken,
|
|
62
63
|
}));
|
|
63
64
|
}
|
|
64
65
|
const errorBuilder = (code, description, details, data) => {
|
package/build/wixClient.js
CHANGED
|
@@ -29,6 +29,7 @@ export function createClient(config) {
|
|
|
29
29
|
..._headers,
|
|
30
30
|
...authHeaders?.headers,
|
|
31
31
|
...options?.headers,
|
|
32
|
+
...config.host?.essentials?.passThroughHeaders,
|
|
32
33
|
},
|
|
33
34
|
});
|
|
34
35
|
};
|
|
@@ -60,7 +61,7 @@ export function createClient(config) {
|
|
|
60
61
|
finalUrl.host = apiBaseUrl;
|
|
61
62
|
finalUrl.protocol = 'https';
|
|
62
63
|
return boundFetch(finalUrl.toString(), fetchOptions);
|
|
63
|
-
}, { HTTPHost: apiBaseUrl });
|
|
64
|
+
}, authStrategy.getActiveToken, { HTTPHost: apiBaseUrl });
|
|
64
65
|
}
|
|
65
66
|
else if (isObject(modules)) {
|
|
66
67
|
return Object.fromEntries(Object.entries(modules).map(([key, value]) => {
|
|
@@ -112,6 +113,12 @@ export function createClient(config) {
|
|
|
112
113
|
}
|
|
113
114
|
}
|
|
114
115
|
},
|
|
116
|
+
/**
|
|
117
|
+
* @param relativeUrl The URL to fetch relative to the API base URL
|
|
118
|
+
* @param options The fetch options
|
|
119
|
+
* @returns The fetch Response object
|
|
120
|
+
* @deprecated Use `fetchWithAuth` instead
|
|
121
|
+
*/
|
|
115
122
|
fetch: (relativeUrl, options) => {
|
|
116
123
|
const apiBaseUrl = config.host?.apiBaseUrl ?? DEFAULT_API_URL;
|
|
117
124
|
const finalUrl = new URL(relativeUrl, `https://${apiBaseUrl}`);
|
|
@@ -2,4 +2,4 @@ import { BuildRESTFunction, PublicMetadata, RESTFunctionDescriptor } from '@wix/
|
|
|
2
2
|
export type RESTModuleOptions = {
|
|
3
3
|
HTTPHost?: string;
|
|
4
4
|
};
|
|
5
|
-
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>;
|
|
5
|
+
export declare function buildRESTDescriptor<T extends RESTFunctionDescriptor>(origFunc: T, publicMetadata: PublicMetadata, boundFetch: typeof fetch, wixAPIFetch: (relativeUrl: string, options: RequestInit) => Promise<Response>, getActiveToken?: () => string | undefined, options?: RESTModuleOptions): BuildRESTFunction<T>;
|
|
@@ -4,7 +4,7 @@ exports.buildRESTDescriptor = void 0;
|
|
|
4
4
|
const biHeaderGenerator_js_1 = require("./bi/biHeaderGenerator.js");
|
|
5
5
|
const common_js_1 = require("./common.js");
|
|
6
6
|
const context_1 = require("@wix/sdk-runtime/context");
|
|
7
|
-
function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, wixAPIFetch, options) {
|
|
7
|
+
function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, wixAPIFetch, getActiveToken, options) {
|
|
8
8
|
return (0, context_1.runWithoutContext)(() => origFunc({
|
|
9
9
|
request: async (factory) => {
|
|
10
10
|
const requestOptions = factory({
|
|
@@ -62,6 +62,7 @@ function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, wixAPIFetch,
|
|
|
62
62
|
},
|
|
63
63
|
fetchWithAuth: boundFetch,
|
|
64
64
|
wixAPIFetch,
|
|
65
|
+
getActiveToken,
|
|
65
66
|
}));
|
|
66
67
|
}
|
|
67
68
|
exports.buildRESTDescriptor = buildRESTDescriptor;
|
package/cjs/build/wixClient.js
CHANGED
|
@@ -32,6 +32,7 @@ function createClient(config) {
|
|
|
32
32
|
..._headers,
|
|
33
33
|
...authHeaders?.headers,
|
|
34
34
|
...options?.headers,
|
|
35
|
+
...config.host?.essentials?.passThroughHeaders,
|
|
35
36
|
},
|
|
36
37
|
});
|
|
37
38
|
};
|
|
@@ -63,7 +64,7 @@ function createClient(config) {
|
|
|
63
64
|
finalUrl.host = apiBaseUrl;
|
|
64
65
|
finalUrl.protocol = 'https';
|
|
65
66
|
return boundFetch(finalUrl.toString(), fetchOptions);
|
|
66
|
-
}, { HTTPHost: apiBaseUrl });
|
|
67
|
+
}, authStrategy.getActiveToken, { HTTPHost: apiBaseUrl });
|
|
67
68
|
}
|
|
68
69
|
else if ((0, helpers_js_1.isObject)(modules)) {
|
|
69
70
|
return Object.fromEntries(Object.entries(modules).map(([key, value]) => {
|
|
@@ -115,6 +116,12 @@ function createClient(config) {
|
|
|
115
116
|
}
|
|
116
117
|
}
|
|
117
118
|
},
|
|
119
|
+
/**
|
|
120
|
+
* @param relativeUrl The URL to fetch relative to the API base URL
|
|
121
|
+
* @param options The fetch options
|
|
122
|
+
* @returns The fetch Response object
|
|
123
|
+
* @deprecated Use `fetchWithAuth` instead
|
|
124
|
+
*/
|
|
118
125
|
fetch: (relativeUrl, options) => {
|
|
119
126
|
const apiBaseUrl = config.host?.apiBaseUrl ?? common_js_1.DEFAULT_API_URL;
|
|
120
127
|
const finalUrl = new URL(relativeUrl, `https://${apiBaseUrl}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/sdk",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Ronny Ringel",
|
|
@@ -65,11 +65,11 @@
|
|
|
65
65
|
"dependencies": {
|
|
66
66
|
"@babel/runtime": "^7.23.2",
|
|
67
67
|
"@wix/identity": "^1.0.78",
|
|
68
|
-
"@wix/image-kit": "^1.
|
|
68
|
+
"@wix/image-kit": "^1.87.0",
|
|
69
69
|
"@wix/redirects": "^1.0.41",
|
|
70
70
|
"@wix/sdk-context": "^0.0.1",
|
|
71
|
-
"@wix/sdk-runtime": "0.3.
|
|
72
|
-
"@wix/sdk-types": "^1.
|
|
71
|
+
"@wix/sdk-runtime": "0.3.20",
|
|
72
|
+
"@wix/sdk-types": "^1.12.1",
|
|
73
73
|
"jose": "^5.2.1",
|
|
74
74
|
"querystring": "^0.2.1",
|
|
75
75
|
"type-fest": "^4.9.0"
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"@wix/events": "^1.0.179",
|
|
86
86
|
"@wix/metro": "^1.0.73",
|
|
87
87
|
"@wix/metro-runtime": "^1.1677.0",
|
|
88
|
-
"@wix/sdk-runtime": "0.3.
|
|
88
|
+
"@wix/sdk-runtime": "0.3.20",
|
|
89
89
|
"eslint": "^8.56.0",
|
|
90
90
|
"eslint-config-sdk": "0.0.0",
|
|
91
91
|
"graphql": "^16.8.0",
|
|
@@ -119,5 +119,5 @@
|
|
|
119
119
|
"wallaby": {
|
|
120
120
|
"autoDetect": true
|
|
121
121
|
},
|
|
122
|
-
"falconPackageHash": "
|
|
122
|
+
"falconPackageHash": "2a7a057c5af253e6e991b4f7f14cd28485c55e8631c6c057f3373333"
|
|
123
123
|
}
|