@symbo.ls/fetch 3.1.2 → 3.2.3

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 CHANGED
@@ -36,8 +36,8 @@ __export(index_exports, {
36
36
  module.exports = __toCommonJS(index_exports);
37
37
  var utils = __toESM(require("@domql/utils"), 1);
38
38
  const { window, overwriteDeep, deepDestringify } = utils;
39
- const IS_DEVELOPMENT = window && window.location ? window.location.host.includes("dev.") : true;
40
- const SERVER_URL = IS_DEVELOPMENT ? "http://localhost:13335/get" : "https://api.symbols.app/get";
39
+ const IS_DEVELOPMENT = window && window.location ? window.location.host.includes("dev.") : utils.isDevelopment();
40
+ const SERVER_URL = IS_DEVELOPMENT ? "http://localhost:8080/get" : "https://api.symbols.app/get";
41
41
  const defaultOptions = {
42
42
  endpoint: SERVER_URL
43
43
  };
@@ -49,7 +49,11 @@ const fetchRemote = async (key, options = defaultOptions) => {
49
49
  try {
50
50
  response = await fetch(baseUrl + "/?" + route, {
51
51
  method: "GET",
52
- headers: { "Content-Type": "application/json", "X-AppKey": key, "X-Metadata": options.metadata }
52
+ headers: {
53
+ "Content-Type": "application/json",
54
+ "X-AppKey": key,
55
+ "X-Metadata": options.metadata
56
+ }
53
57
  });
54
58
  return await response.json();
55
59
  } catch (e) {
@@ -71,6 +75,7 @@ const fetchProject = async (key, options) => {
71
75
  overwriteDeep(options[editor.serviceRoute], evalData);
72
76
  }
73
77
  } else {
78
+ ;
74
79
  [
75
80
  "state",
76
81
  "designSystem",
package/dist/esm/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as utils from "@domql/utils";
2
2
  const { window, overwriteDeep, deepDestringify } = utils;
3
- const IS_DEVELOPMENT = window && window.location ? window.location.host.includes("dev.") : true;
4
- const SERVER_URL = IS_DEVELOPMENT ? "http://localhost:13335/get" : "https://api.symbols.app/get";
3
+ const IS_DEVELOPMENT = window && window.location ? window.location.host.includes("dev.") : utils.isDevelopment();
4
+ const SERVER_URL = IS_DEVELOPMENT ? "http://localhost:8080/get" : "https://api.symbols.app/get";
5
5
  const defaultOptions = {
6
6
  endpoint: SERVER_URL
7
7
  };
@@ -13,7 +13,11 @@ const fetchRemote = async (key, options = defaultOptions) => {
13
13
  try {
14
14
  response = await fetch(baseUrl + "/?" + route, {
15
15
  method: "GET",
16
- headers: { "Content-Type": "application/json", "X-AppKey": key, "X-Metadata": options.metadata }
16
+ headers: {
17
+ "Content-Type": "application/json",
18
+ "X-AppKey": key,
19
+ "X-Metadata": options.metadata
20
+ }
17
21
  });
18
22
  return await response.json();
19
23
  } catch (e) {
@@ -35,6 +39,7 @@ const fetchProject = async (key, options) => {
35
39
  overwriteDeep(options[editor.serviceRoute], evalData);
36
40
  }
37
41
  } else {
42
+ ;
38
43
  [
39
44
  "state",
40
45
  "designSystem",
package/index.js CHANGED
@@ -6,10 +6,10 @@ const { window, overwriteDeep, deepDestringify } = utils
6
6
  const IS_DEVELOPMENT =
7
7
  window && window.location
8
8
  ? window.location.host.includes('dev.')
9
- : process.env.NODE_ENV === 'development'
9
+ : utils.isDevelopment()
10
10
 
11
11
  const SERVER_URL = IS_DEVELOPMENT
12
- ? 'http://localhost:13335/get'
12
+ ? 'http://localhost:8080/get'
13
13
  : 'https://api.symbols.app/get'
14
14
 
15
15
  const defaultOptions = {
@@ -22,7 +22,7 @@ export const fetchRemote = async (key, options = defaultOptions) => {
22
22
  const baseUrl = options.endpoint || SERVER_URL
23
23
  const route = options.serviceRoute
24
24
  ? utils.isArray(options.serviceRoute)
25
- ? options.serviceRoute.map((v) => v.toLowerCase() + '=true').join('&')
25
+ ? options.serviceRoute.map(v => v.toLowerCase() + '=true').join('&')
26
26
  : options.serviceRoute
27
27
  : ''
28
28
 
@@ -30,7 +30,11 @@ export const fetchRemote = async (key, options = defaultOptions) => {
30
30
  try {
31
31
  response = await fetch(baseUrl + '/' + '?' + route, {
32
32
  method: 'GET',
33
- headers: { 'Content-Type': 'application/json', 'X-AppKey': key, 'X-Metadata': options.metadata }
33
+ headers: {
34
+ 'Content-Type': 'application/json',
35
+ 'X-AppKey': key,
36
+ 'X-Metadata': options.metadata
37
+ }
34
38
  })
35
39
 
36
40
  return await response.json()
@@ -45,20 +49,21 @@ export const fetchProject = async (key, options) => {
45
49
 
46
50
  if (editor && editor.remote) {
47
51
  const data = await fetchRemote(key, editor)
48
- const evalData = (IS_DEVELOPMENT || options.isDevelopment)
49
- ? deepDestringify(data)
50
- : deepDestringify(data.releases[0])
52
+ const evalData =
53
+ IS_DEVELOPMENT || options.isDevelopment
54
+ ? deepDestringify(data)
55
+ : deepDestringify(data.releases[0])
51
56
 
52
57
  if (editor.serviceRoute) {
53
58
  if (utils.isArray(editor.serviceRoute)) {
54
- editor.serviceRoute.forEach((route) => {
59
+ editor.serviceRoute.forEach(route => {
55
60
  overwriteDeep(options[route], evalData[route.toLowerCase()])
56
61
  })
57
62
  } else {
58
63
  overwriteDeep(options[editor.serviceRoute], evalData)
59
64
  }
60
65
  } else {
61
- [
66
+ ;[
62
67
  'state',
63
68
  'designSystem',
64
69
  'components',
@@ -68,7 +73,7 @@ export const fetchProject = async (key, options) => {
68
73
  'files',
69
74
  'packages',
70
75
  'functions'
71
- ].forEach((key) => {
76
+ ].forEach(key => {
72
77
  overwriteDeep(options[key], evalData[key.toLowerCase()])
73
78
  })
74
79
  }
@@ -82,9 +87,10 @@ export const fetchProjectAsync = async (key, options, callback) => {
82
87
 
83
88
  if (editor && editor.remote) {
84
89
  const data = await fetchRemote(key, editor)
85
- const evalData = (IS_DEVELOPMENT || options.isDevelopment)
86
- ? deepDestringify(data)
87
- : deepDestringify(data.releases[0])
90
+ const evalData =
91
+ IS_DEVELOPMENT || options.isDevelopment
92
+ ? deepDestringify(data)
93
+ : deepDestringify(data.releases[0])
88
94
  callback(evalData)
89
95
  }
90
96
  }
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@symbo.ls/fetch",
3
- "version": "3.1.2",
3
+ "version": "3.2.3",
4
4
  "license": "MIT",
5
- "gitHead": "429b36616aa04c8587a26ce3c129815115e35897",
5
+ "gitHead": "9fc1b79b41cdc725ca6b24aec64920a599634681",
6
6
  "type": "module",
7
7
  "module": "index.js",
8
8
  "main": "index.js",
@@ -10,9 +10,9 @@
10
10
  "jsdelivr": "dist/iife/index.js",
11
11
  "exports": {
12
12
  ".": {
13
- "default": "./dist/esm/index.js",
14
13
  "import": "./dist/esm/index.js",
15
- "require": "./dist/cjs/index.js"
14
+ "require": "./dist/cjs/index.js",
15
+ "default": "./dist/esm/index.js"
16
16
  }
17
17
  },
18
18
  "source": "index.js",
@@ -22,13 +22,13 @@
22
22
  ],
23
23
  "scripts": {
24
24
  "copy:package:cjs": "cp ../../build/package-cjs.json dist/cjs/package.json",
25
- "build:esm": "npx esbuild *.js --target=es2017 --format=esm --outdir=dist/esm",
26
- "build:cjs": "npx esbuild *.js --target=node16 --format=cjs --outdir=dist/cjs",
27
- "build:iife": "npx esbuild *.js --target=node16 --format=iife --outdir=dist/iife",
25
+ "build:esm": "npx cross-env NODE_ENV=$NODE_ENV npx esbuild *.js --target=es2017 --format=esm --outdir=dist/esm",
26
+ "build:cjs": "npx cross-env NODE_ENV=$NODE_ENV npx esbuild *.js --target=node16 --format=cjs --outdir=dist/cjs",
27
+ "build:iife": "npx cross-env NODE_ENV=$NODE_ENV npx esbuild *.js --target=node16 --format=iife --outdir=dist/iife",
28
28
  "build": "rimraf -I dist; npm run build:cjs; npm run build:esm",
29
29
  "prepublish": "npm run build; npm run copy:package:cjs"
30
30
  },
31
31
  "dependencies": {
32
- "@domql/utils": "^3.1.2"
32
+ "@domql/utils": "^3.2.3"
33
33
  }
34
34
  }