strapi-sdk-js 2.3.1 → 2.3.2-rc.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.
- package/dist/index.cjs +24 -9
- package/dist/index.mjs +6 -10
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -6,6 +6,25 @@ var qs = require('qs');
|
|
|
6
6
|
var Cookies = require('js-cookie');
|
|
7
7
|
var ufo = require('ufo');
|
|
8
8
|
|
|
9
|
+
function _interopNamespaceDefault(e) {
|
|
10
|
+
var n = Object.create(null);
|
|
11
|
+
if (e) {
|
|
12
|
+
Object.keys(e).forEach(function (k) {
|
|
13
|
+
if (k !== 'default') {
|
|
14
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
get: function () { return e[k]; }
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
n.default = e;
|
|
23
|
+
return Object.freeze(n);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
var ufo__namespace = /*#__PURE__*/_interopNamespaceDefault(ufo);
|
|
27
|
+
|
|
9
28
|
function isBrowser() {
|
|
10
29
|
return typeof window !== "undefined";
|
|
11
30
|
}
|
|
@@ -16,6 +35,7 @@ var __publicField = (obj, key, value) => {
|
|
|
16
35
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
17
36
|
return value;
|
|
18
37
|
};
|
|
38
|
+
const { cleanDoubleSlashes, joinURL } = ufo__namespace;
|
|
19
39
|
const defaults = {
|
|
20
40
|
url: "http://localhost:1337",
|
|
21
41
|
prefix: "/api",
|
|
@@ -43,11 +63,11 @@ class Strapi {
|
|
|
43
63
|
const _options = defu(options || {}, defaults);
|
|
44
64
|
this.options = {
|
|
45
65
|
..._options,
|
|
46
|
-
url:
|
|
47
|
-
prefix:
|
|
66
|
+
url: cleanDoubleSlashes(_options == null ? void 0 : _options.url),
|
|
67
|
+
prefix: cleanDoubleSlashes(_options == null ? void 0 : _options.prefix)
|
|
48
68
|
};
|
|
49
69
|
this.axios = axios.create({
|
|
50
|
-
baseURL:
|
|
70
|
+
baseURL: joinURL(this.options.url, this.options.prefix),
|
|
51
71
|
paramsSerializer: qs.stringify,
|
|
52
72
|
...this.options.axiosOptions
|
|
53
73
|
});
|
|
@@ -208,12 +228,7 @@ class Strapi {
|
|
|
208
228
|
* @returns string
|
|
209
229
|
*/
|
|
210
230
|
getProviderAuthenticationUrl(provider) {
|
|
211
|
-
return
|
|
212
|
-
this.options.url,
|
|
213
|
-
this.options.prefix,
|
|
214
|
-
"connect",
|
|
215
|
-
provider
|
|
216
|
-
);
|
|
231
|
+
return joinURL(this.options.url, this.options.prefix, "connect", provider);
|
|
217
232
|
}
|
|
218
233
|
/**
|
|
219
234
|
* Authenticate user with the token present on the URL or in `params`
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import axios from 'axios';
|
|
|
2
2
|
import defu from 'defu';
|
|
3
3
|
import qs from 'qs';
|
|
4
4
|
import Cookies from 'js-cookie';
|
|
5
|
-
import ufo from 'ufo';
|
|
5
|
+
import * as ufo from 'ufo';
|
|
6
6
|
|
|
7
7
|
function isBrowser() {
|
|
8
8
|
return typeof window !== "undefined";
|
|
@@ -14,6 +14,7 @@ var __publicField = (obj, key, value) => {
|
|
|
14
14
|
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
15
15
|
return value;
|
|
16
16
|
};
|
|
17
|
+
const { cleanDoubleSlashes, joinURL } = ufo;
|
|
17
18
|
const defaults = {
|
|
18
19
|
url: "http://localhost:1337",
|
|
19
20
|
prefix: "/api",
|
|
@@ -41,11 +42,11 @@ class Strapi {
|
|
|
41
42
|
const _options = defu(options || {}, defaults);
|
|
42
43
|
this.options = {
|
|
43
44
|
..._options,
|
|
44
|
-
url:
|
|
45
|
-
prefix:
|
|
45
|
+
url: cleanDoubleSlashes(_options == null ? void 0 : _options.url),
|
|
46
|
+
prefix: cleanDoubleSlashes(_options == null ? void 0 : _options.prefix)
|
|
46
47
|
};
|
|
47
48
|
this.axios = axios.create({
|
|
48
|
-
baseURL:
|
|
49
|
+
baseURL: joinURL(this.options.url, this.options.prefix),
|
|
49
50
|
paramsSerializer: qs.stringify,
|
|
50
51
|
...this.options.axiosOptions
|
|
51
52
|
});
|
|
@@ -206,12 +207,7 @@ class Strapi {
|
|
|
206
207
|
* @returns string
|
|
207
208
|
*/
|
|
208
209
|
getProviderAuthenticationUrl(provider) {
|
|
209
|
-
return
|
|
210
|
-
this.options.url,
|
|
211
|
-
this.options.prefix,
|
|
212
|
-
"connect",
|
|
213
|
-
provider
|
|
214
|
-
);
|
|
210
|
+
return joinURL(this.options.url, this.options.prefix, "connect", provider);
|
|
215
211
|
}
|
|
216
212
|
/**
|
|
217
213
|
* Authenticate user with the token present on the URL or in `params`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "strapi-sdk-js",
|
|
3
|
-
"version": "2.3.1",
|
|
3
|
+
"version": "2.3.2-rc.1",
|
|
4
4
|
"description": "📦 Javascript SDK for your Strapi API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"strapi",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
],
|
|
52
52
|
"scripts": {
|
|
53
53
|
"start": "rollup -c --watch",
|
|
54
|
-
"build": "rollup -c",
|
|
54
|
+
"build": "rm -rf dist && rollup -c",
|
|
55
55
|
"clean": "rm -rf bin dist coverage",
|
|
56
56
|
"lint": "eslint . --ext .ts,.js",
|
|
57
57
|
"lint:fix": "eslint . --ext .ts,.js --fix",
|