@navservice/core 1.71.0 → 1.72.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/es/index.js CHANGED
@@ -150,6 +150,15 @@ const _session_storage = class {
150
150
  }
151
151
  };
152
152
  const utils_session_storage = _session_storage;
153
+ const _environment = class {
154
+ static set(props) {
155
+ window.sessionStorage.setItem("ENVIRONMENT", props);
156
+ }
157
+ static get get() {
158
+ return window.sessionStorage.get("ENVIRONMENT");
159
+ }
160
+ };
161
+ const utils_environment = _environment;
153
162
  const _api_api = class _api {
154
163
  static servidor_pricipal = class {
155
164
  static get #axios() {
@@ -160,10 +169,10 @@ const _api_api = class _api {
160
169
  static resolve_base_url() {
161
170
  if ("undefined" == typeof window) throw new Error("resolveApiBaseURL must run in browser");
162
171
  const { hostname } = window.location;
163
- const apiOverride = window.sessionStorage.get("API_TARGET");
164
- if ("sandbox" === apiOverride) return "https://api-sandbox.navsoftware.com.br";
165
- if ("prod" === apiOverride) return "https://api.navsoftware.com.br";
166
- if ("local" === apiOverride) return "http://localhost:8787";
172
+ const apiOverride = utils_environment.get;
173
+ if ("SANDBOX" === apiOverride) return "https://api-sandbox.navsoftware.com.br";
174
+ if ("PRODUCAO" === apiOverride) return "https://api.navsoftware.com.br";
175
+ if ("LOCALHOST" === apiOverride) return "http://localhost:8787";
167
176
  if ("localhost" === hostname || hostname.startsWith("localhost")) return "http://localhost:8787";
168
177
  const isNavSoftware = hostname.includes("navsoftware");
169
178
  const isSandbox = hostname.includes("sandbox");
@@ -628,15 +637,6 @@ class _hooks {
628
637
  }
629
638
  }
630
639
  const utils_hooks = new _hooks;
631
- const _environment = class {
632
- static set(props) {
633
- window.sessionStorage.setItem("ENVIRONMENT", props);
634
- }
635
- static get get() {
636
- return window.sessionStorage.get("ENVIRONMENT");
637
- }
638
- };
639
- const utils_environment = _environment;
640
640
  const utils = {
641
641
  api: utils_api,
642
642
  data: utils_data,
@@ -1,6 +1,7 @@
1
+ type Envronment = "LOCALHOST" | "PRODUCAO" | "SANDBOX";
1
2
  declare const _environment: {
2
3
  new (): {};
3
- set(props: "LOCALHOST" | "PRODUCAO" | "SANDBOX"): void;
4
- get get(): any;
4
+ set(props: Envronment): void;
5
+ get get(): Envronment;
5
6
  };
6
7
  export default _environment;
@@ -155,8 +155,8 @@ declare const utils: {
155
155
  };
156
156
  environment: {
157
157
  new (): {};
158
- set(props: "LOCALHOST" | "PRODUCAO" | "SANDBOX"): void;
159
- get get(): any;
158
+ set(props: "PRODUCAO" | "SANDBOX" | "LOCALHOST"): void;
159
+ get get(): "PRODUCAO" | "SANDBOX" | "LOCALHOST";
160
160
  };
161
161
  };
162
162
  export default utils;
@@ -224,9 +224,26 @@ const _session_storage = class _session_storage {
224
224
  };
225
225
  /* export default */ const utils_session_storage = (_session_storage);
226
226
 
227
+ ;// CONCATENATED MODULE: ./src/utils/_environment.ts
228
+ //BIBLIOTECAS
229
+ //HELPERS
230
+ //BANCO DE DADOS
231
+ //SERVICES
232
+ const _environment = class _environment {
233
+ static set(props) {
234
+ window.sessionStorage.setItem("ENVIRONMENT", props);
235
+ return;
236
+ }
237
+ static get get() {
238
+ return window.sessionStorage.get("ENVIRONMENT");
239
+ }
240
+ };
241
+ /* export default */ const utils_environment = (_environment);
242
+
227
243
  ;// CONCATENATED MODULE: ./src/utils/_api.ts
228
244
 
229
245
 
246
+
230
247
  const _api_api = class _api {
231
248
  static servidor_pricipal = class servidor_pricipal {
232
249
  static get #axios() {
@@ -239,14 +256,14 @@ const _api_api = class _api {
239
256
  throw new Error("resolveApiBaseURL must run in browser");
240
257
  }
241
258
  const { hostname } = window.location;
242
- const apiOverride = window.sessionStorage.get("API_TARGET");
243
- if (apiOverride === "sandbox") {
259
+ const apiOverride = utils_environment.get;
260
+ if (apiOverride === "SANDBOX") {
244
261
  return "https://api-sandbox.navsoftware.com.br";
245
262
  }
246
- if (apiOverride === "prod") {
263
+ if (apiOverride === "PRODUCAO") {
247
264
  return "https://api.navsoftware.com.br";
248
265
  }
249
- if (apiOverride === "local") {
266
+ if (apiOverride === "LOCALHOST") {
250
267
  return "http://localhost:8787";
251
268
  }
252
269
  if (hostname === "localhost" || hostname.startsWith("localhost")) {
@@ -812,22 +829,6 @@ class _hooks {
812
829
  }
813
830
  /* export default */ const utils_hooks = (new _hooks);
814
831
 
815
- ;// CONCATENATED MODULE: ./src/utils/_environment.ts
816
- //BIBLIOTECAS
817
- //HELPERS
818
- //BANCO DE DADOS
819
- //SERVICES
820
- const _environment = class _environment {
821
- static set(props) {
822
- window.sessionStorage.setItem("ENVIRONMENT", props);
823
- return;
824
- }
825
- static get get() {
826
- return window.sessionStorage.get("ENVIRONMENT");
827
- }
828
- };
829
- /* export default */ const utils_environment = (_environment);
830
-
831
832
  ;// CONCATENATED MODULE: ./src/utils/index.ts
832
833
 
833
834
 
@@ -1,6 +1,7 @@
1
+ type Envronment = "LOCALHOST" | "PRODUCAO" | "SANDBOX";
1
2
  declare const _environment: {
2
3
  new (): {};
3
- set(props: "LOCALHOST" | "PRODUCAO" | "SANDBOX"): void;
4
- get get(): any;
4
+ set(props: Envronment): void;
5
+ get get(): Envronment;
5
6
  };
6
7
  export default _environment;
@@ -155,8 +155,8 @@ declare const utils: {
155
155
  };
156
156
  environment: {
157
157
  new (): {};
158
- set(props: "LOCALHOST" | "PRODUCAO" | "SANDBOX"): void;
159
- get get(): any;
158
+ set(props: "PRODUCAO" | "SANDBOX" | "LOCALHOST"): void;
159
+ get get(): "PRODUCAO" | "SANDBOX" | "LOCALHOST";
160
160
  };
161
161
  };
162
162
  export default utils;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navservice/core",
3
- "version": "1.71.0",
3
+ "version": "1.72.0",
4
4
  "description": "Service core de todos os micro serviços",
5
5
  "type": "module",
6
6
  "exports": {