@navservice/core 1.72.0 → 1.73.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
@@ -167,18 +167,21 @@ const _api_api = class _api {
167
167
  });
168
168
  }
169
169
  static resolve_base_url() {
170
- if ("undefined" == typeof window) throw new Error("resolveApiBaseURL must run in browser");
171
- const { hostname } = window.location;
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";
176
- if ("localhost" === hostname || hostname.startsWith("localhost")) return "http://localhost:8787";
177
- const isNavSoftware = hostname.includes("navsoftware");
178
- const isSandbox = hostname.includes("sandbox");
179
- if (isNavSoftware && isSandbox) return "https://api-sandbox.navsoftware.com.br";
180
- if (isNavSoftware) return "https://api.navsoftware.com.br";
181
- throw new Error(`Ambiente não reconhecido: ${hostname}`);
170
+ try {
171
+ if ("undefined" == typeof window) throw new Error("resolveApiBaseURL must run in browser");
172
+ const { hostname } = window.location;
173
+ const apiOverride = utils_environment.get;
174
+ if ("SANDBOX" === apiOverride) return "https://api-sandbox.navsoftware.com.br";
175
+ if ("PRODUCAO" === apiOverride) return "https://api.navsoftware.com.br";
176
+ if ("LOCALHOST" === apiOverride) return "http://localhost:8787";
177
+ if ("localhost" === hostname || hostname.startsWith("localhost")) return "http://localhost:8787";
178
+ const isNavSoftware = hostname.includes("navsoftware");
179
+ const isSandbox = hostname.includes("sandbox");
180
+ if (isNavSoftware && isSandbox) return "https://api-sandbox.navsoftware.com.br";
181
+ if (isNavSoftware) return "https://api.navsoftware.com.br";
182
+ } catch (error) {
183
+ throw new Error(`Ambiente não reconhecido: ${error}`);
184
+ }
182
185
  }
183
186
  static async post({ url, data, setToken = true }) {
184
187
  return await this.#axios.post(url, data, _api.headers({
@@ -4,7 +4,7 @@ declare const _api: {
4
4
  servidor_pricipal: {
5
5
  new (): {};
6
6
  get "__#private@#axios"(): import("axios").AxiosInstance;
7
- resolve_base_url(): string;
7
+ resolve_base_url(): string | any;
8
8
  post({ url, data, setToken }: {
9
9
  url: string;
10
10
  data: any;
@@ -5,7 +5,7 @@ declare const utils: {
5
5
  servidor_pricipal: {
6
6
  new (): {};
7
7
  get "__#private@#axios"(): import("axios").AxiosInstance;
8
- resolve_base_url(): string;
8
+ resolve_base_url(): string | any;
9
9
  post({ url, data, setToken }: {
10
10
  url: string;
11
11
  data: any;
@@ -252,32 +252,35 @@ const _api_api = class _api {
252
252
  });
253
253
  }
254
254
  static resolve_base_url() {
255
- if (typeof window === "undefined") {
256
- throw new Error("resolveApiBaseURL must run in browser");
257
- }
258
- const { hostname } = window.location;
259
- const apiOverride = utils_environment.get;
260
- if (apiOverride === "SANDBOX") {
261
- return "https://api-sandbox.navsoftware.com.br";
262
- }
263
- if (apiOverride === "PRODUCAO") {
264
- return "https://api.navsoftware.com.br";
265
- }
266
- if (apiOverride === "LOCALHOST") {
267
- return "http://localhost:8787";
268
- }
269
- if (hostname === "localhost" || hostname.startsWith("localhost")) {
270
- return "http://localhost:8787";
271
- }
272
- const isNavSoftware = hostname.includes("navsoftware");
273
- const isSandbox = hostname.includes("sandbox");
274
- if (isNavSoftware && isSandbox) {
275
- return "https://api-sandbox.navsoftware.com.br";
276
- }
277
- if (isNavSoftware) {
278
- return "https://api.navsoftware.com.br";
255
+ try {
256
+ if (typeof window === "undefined") {
257
+ throw new Error("resolveApiBaseURL must run in browser");
258
+ }
259
+ const { hostname } = window.location;
260
+ const apiOverride = utils_environment.get;
261
+ if (apiOverride === "SANDBOX") {
262
+ return "https://api-sandbox.navsoftware.com.br";
263
+ }
264
+ if (apiOverride === "PRODUCAO") {
265
+ return "https://api.navsoftware.com.br";
266
+ }
267
+ if (apiOverride === "LOCALHOST") {
268
+ return "http://localhost:8787";
269
+ }
270
+ if (hostname === "localhost" || hostname.startsWith("localhost")) {
271
+ return "http://localhost:8787";
272
+ }
273
+ const isNavSoftware = hostname.includes("navsoftware");
274
+ const isSandbox = hostname.includes("sandbox");
275
+ if (isNavSoftware && isSandbox) {
276
+ return "https://api-sandbox.navsoftware.com.br";
277
+ }
278
+ if (isNavSoftware) {
279
+ return "https://api.navsoftware.com.br";
280
+ }
281
+ } catch (error) {
282
+ throw new Error(`Ambiente não reconhecido: ${error}`);
279
283
  }
280
- throw new Error(`Ambiente não reconhecido: ${hostname}`);
281
284
  }
282
285
  static async post({ url, data, setToken = true }) {
283
286
  return await this.#axios.post(url, data, _api.headers({
@@ -4,7 +4,7 @@ declare const _api: {
4
4
  servidor_pricipal: {
5
5
  new (): {};
6
6
  get "__#private@#axios"(): import("axios").AxiosInstance;
7
- resolve_base_url(): string;
7
+ resolve_base_url(): string | any;
8
8
  post({ url, data, setToken }: {
9
9
  url: string;
10
10
  data: any;
@@ -5,7 +5,7 @@ declare const utils: {
5
5
  servidor_pricipal: {
6
6
  new (): {};
7
7
  get "__#private@#axios"(): import("axios").AxiosInstance;
8
- resolve_base_url(): string;
8
+ resolve_base_url(): string | any;
9
9
  post({ url, data, setToken }: {
10
10
  url: string;
11
11
  data: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navservice/core",
3
- "version": "1.72.0",
3
+ "version": "1.73.0",
4
4
  "description": "Service core de todos os micro serviços",
5
5
  "type": "module",
6
6
  "exports": {