@symbo.ls/fetch 2.11.221 → 2.11.291
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/cjs/index.js +10 -5
- package/index.js +19 -12
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -39,7 +39,7 @@ var globals = __toESM(require("@domql/globals"), 1);
|
|
|
39
39
|
const { overwriteDeep, deepDestringify } = utils;
|
|
40
40
|
const { window } = globals;
|
|
41
41
|
const IS_DEVELOPMENT = window && window.location ? window.location.host.includes("dev.") || window.location.host.includes("symbo.ls") : true;
|
|
42
|
-
const SERVER_URL = IS_DEVELOPMENT ? "http://localhost:13335/" : "https://api.symbols.app/";
|
|
42
|
+
const SERVER_URL = IS_DEVELOPMENT ? "http://localhost:13335/get/" : "https://api.symbols.app/get/";
|
|
43
43
|
const defaultOptions = {
|
|
44
44
|
endpoint: SERVER_URL
|
|
45
45
|
};
|
|
@@ -67,9 +67,6 @@ const fetchProject = async (key, options) => {
|
|
|
67
67
|
const data = await fetchRemote(key, editor);
|
|
68
68
|
const evalData = IS_DEVELOPMENT ? deepDestringify(data) : deepDestringify(data.releases[0]);
|
|
69
69
|
if (editor.serviceRoute) {
|
|
70
|
-
console.log(editor.serviceRoute);
|
|
71
|
-
console.log(evalData);
|
|
72
|
-
console.log(options);
|
|
73
70
|
if (utils.isArray(editor.serviceRoute)) {
|
|
74
71
|
editor.serviceRoute.forEach((route) => {
|
|
75
72
|
overwriteDeep(options[route], evalData[route.toLowerCase()]);
|
|
@@ -78,7 +75,15 @@ const fetchProject = async (key, options) => {
|
|
|
78
75
|
overwriteDeep(options[editor.serviceRoute], evalData);
|
|
79
76
|
}
|
|
80
77
|
} else {
|
|
81
|
-
[
|
|
78
|
+
[
|
|
79
|
+
"state",
|
|
80
|
+
"designSystem",
|
|
81
|
+
"components",
|
|
82
|
+
"snippets",
|
|
83
|
+
"pages",
|
|
84
|
+
"utils",
|
|
85
|
+
"functions"
|
|
86
|
+
].forEach((key2) => {
|
|
82
87
|
overwriteDeep(options[key2], evalData[key2.toLowerCase()]);
|
|
83
88
|
});
|
|
84
89
|
}
|
package/index.js
CHANGED
|
@@ -2,17 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
import * as utils from '@domql/utils'
|
|
4
4
|
import * as globals from '@domql/globals'
|
|
5
|
-
|
|
6
5
|
const { overwriteDeep, deepDestringify } = utils
|
|
7
6
|
const { window } = globals
|
|
8
7
|
|
|
9
|
-
const IS_DEVELOPMENT =
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const IS_DEVELOPMENT =
|
|
9
|
+
window && window.location
|
|
10
|
+
? window.location.host.includes('dev.') ||
|
|
11
|
+
window.location.host.includes('symbo.ls')
|
|
12
|
+
: process.env.NODE_ENV === 'development'
|
|
12
13
|
|
|
13
14
|
const SERVER_URL = IS_DEVELOPMENT
|
|
14
|
-
? 'http://localhost:13335/'
|
|
15
|
-
: 'https://api.symbols.app/'
|
|
15
|
+
? 'http://localhost:13335/get/'
|
|
16
|
+
: 'https://api.symbols.app/get/'
|
|
16
17
|
|
|
17
18
|
const defaultOptions = {
|
|
18
19
|
endpoint: SERVER_URL
|
|
@@ -24,7 +25,7 @@ export const fetchRemote = async (key, options = defaultOptions) => {
|
|
|
24
25
|
const baseUrl = options.endpoint || SERVER_URL
|
|
25
26
|
const route = options.serviceRoute
|
|
26
27
|
? utils.isArray(options.serviceRoute)
|
|
27
|
-
? options.serviceRoute.map(v => v.toLowerCase()).join(',')
|
|
28
|
+
? options.serviceRoute.map((v) => v.toLowerCase()).join(',')
|
|
28
29
|
: options.serviceRoute
|
|
29
30
|
: ''
|
|
30
31
|
|
|
@@ -34,6 +35,7 @@ export const fetchRemote = async (key, options = defaultOptions) => {
|
|
|
34
35
|
method: 'GET',
|
|
35
36
|
headers: { 'Content-Type': 'application/json', 'X-AppKey': key }
|
|
36
37
|
})
|
|
38
|
+
|
|
37
39
|
return await response.json()
|
|
38
40
|
} catch (e) {
|
|
39
41
|
if (utils.isFunction(options.onError)) return options.onError(e)
|
|
@@ -51,18 +53,23 @@ export const fetchProject = async (key, options) => {
|
|
|
51
53
|
: deepDestringify(data.releases[0])
|
|
52
54
|
|
|
53
55
|
if (editor.serviceRoute) {
|
|
54
|
-
console.log(editor.serviceRoute)
|
|
55
|
-
console.log(evalData)
|
|
56
|
-
console.log(options)
|
|
57
56
|
if (utils.isArray(editor.serviceRoute)) {
|
|
58
|
-
editor.serviceRoute.forEach(route => {
|
|
57
|
+
editor.serviceRoute.forEach((route) => {
|
|
59
58
|
overwriteDeep(options[route], evalData[route.toLowerCase()])
|
|
60
59
|
})
|
|
61
60
|
} else {
|
|
62
61
|
overwriteDeep(options[editor.serviceRoute], evalData)
|
|
63
62
|
}
|
|
64
63
|
} else {
|
|
65
|
-
[
|
|
64
|
+
[
|
|
65
|
+
'state',
|
|
66
|
+
'designSystem',
|
|
67
|
+
'components',
|
|
68
|
+
'snippets',
|
|
69
|
+
'pages',
|
|
70
|
+
'utils',
|
|
71
|
+
'functions'
|
|
72
|
+
].forEach((key) => {
|
|
66
73
|
overwriteDeep(options[key], evalData[key.toLowerCase()])
|
|
67
74
|
})
|
|
68
75
|
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@symbo.ls/fetch",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.291",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"gitHead": "
|
|
5
|
+
"gitHead": "54f3dd0f443356a9cc26b3005ad352d5333f0c11",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"module": "index.js",
|
|
8
8
|
"main": "index.js",
|