@navservice/core 1.69.0 → 1.70.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.d.ts +0 -1
- package/build/es/index.js +14 -14
- package/build/es/utils/_api.d.ts +1 -0
- package/build/es/utils/index.d.ts +1 -0
- package/build/lib/index.cjs +20 -18
- package/build/lib/index.d.ts +0 -1
- package/build/lib/utils/_api.d.ts +1 -0
- package/build/lib/utils/index.d.ts +1 -0
- package/package.json +1 -1
- package/build/es/config_env/index.d.ts +0 -9
- package/build/lib/config_env/index.d.ts +0 -9
package/build/es/index.d.ts
CHANGED
package/build/es/index.js
CHANGED
|
@@ -1,16 +1,6 @@
|
|
|
1
1
|
import v4 from "zod/v4";
|
|
2
2
|
import axios from "axios";
|
|
3
3
|
import { useLayoutEffect, useState } from "react";
|
|
4
|
-
class config_env {
|
|
5
|
-
static SET_PUBLIC_BASE_URL_BACKEND_PRINCIPAL;
|
|
6
|
-
static init(config) {
|
|
7
|
-
config_env.SET_PUBLIC_BASE_URL_BACKEND_PRINCIPAL = config.SET_PUBLIC_BASE_URL_BACKEND_PRINCIPAL;
|
|
8
|
-
}
|
|
9
|
-
static get PUBLIC_BASE_URL_BACKEND_PRINCIPAL() {
|
|
10
|
-
return this.SET_PUBLIC_BASE_URL_BACKEND_PRINCIPAL?.trim();
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
const src_config_env = config_env;
|
|
14
4
|
(function(TypeControllerUsuario) {
|
|
15
5
|
TypeControllerUsuario.AppEnum = [
|
|
16
6
|
"service-usuario",
|
|
@@ -94,8 +84,8 @@ var _usuario_TypeControllerUsuario;
|
|
|
94
84
|
c: v4.custom().optional()
|
|
95
85
|
});
|
|
96
86
|
})(TypeControllerResponse.C || (TypeControllerResponse.C = {}));
|
|
97
|
-
(function(
|
|
98
|
-
|
|
87
|
+
(function(Error1) {
|
|
88
|
+
Error1.InputSchema = v4.object({
|
|
99
89
|
message: v4.string().optional(),
|
|
100
90
|
results: v4.union([
|
|
101
91
|
v4.array(v4.unknown()),
|
|
@@ -164,9 +154,19 @@ const _api_api = class _api {
|
|
|
164
154
|
static servidor_pricipal = class {
|
|
165
155
|
static get #axios() {
|
|
166
156
|
return axios.create({
|
|
167
|
-
baseURL:
|
|
157
|
+
baseURL: this.resolve_base_url()
|
|
168
158
|
});
|
|
169
159
|
}
|
|
160
|
+
static resolve_base_url() {
|
|
161
|
+
if ("undefined" == typeof window) throw new Error("resolveApiBaseURL must run in browser");
|
|
162
|
+
const { hostname } = window.location;
|
|
163
|
+
if ("localhost" === hostname || hostname.startsWith("localhost")) return "http://localhost:8787";
|
|
164
|
+
const isNavSoftware = hostname.includes("navsoftware");
|
|
165
|
+
const isSandbox = hostname.includes("sandbox");
|
|
166
|
+
if (isNavSoftware && isSandbox) return "https://api-sandbox.navsoftware.com.br";
|
|
167
|
+
if (isNavSoftware) return "https://api.navsoftware.com.br";
|
|
168
|
+
throw new Error(`Ambiente não reconhecido: ${hostname}`);
|
|
169
|
+
}
|
|
170
170
|
static async post({ url, data, setToken = true }) {
|
|
171
171
|
return await this.#axios.post(url, data, _api.headers({
|
|
172
172
|
setToken: setToken
|
|
@@ -636,4 +636,4 @@ const utils = {
|
|
|
636
636
|
hooks: utils_hooks
|
|
637
637
|
};
|
|
638
638
|
const src_utils = utils;
|
|
639
|
-
export { types as TypesCore,
|
|
639
|
+
export { types as TypesCore, src_utils as utils };
|
package/build/es/utils/_api.d.ts
CHANGED
package/build/lib/index.cjs
CHANGED
|
@@ -51,23 +51,10 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
51
51
|
|
|
52
52
|
// EXPORTS
|
|
53
53
|
__webpack_require__.d(__webpack_exports__, {
|
|
54
|
-
config_env_core: () => (/* reexport */ src_config_env),
|
|
55
54
|
TypesCore: () => (/* reexport */ types),
|
|
56
55
|
utils: () => (/* reexport */ src_utils)
|
|
57
56
|
});
|
|
58
57
|
|
|
59
|
-
;// CONCATENATED MODULE: ./src/config_env/index.ts
|
|
60
|
-
class config_env {
|
|
61
|
-
static SET_PUBLIC_BASE_URL_BACKEND_PRINCIPAL;
|
|
62
|
-
static init(config) {
|
|
63
|
-
config_env.SET_PUBLIC_BASE_URL_BACKEND_PRINCIPAL = config.SET_PUBLIC_BASE_URL_BACKEND_PRINCIPAL;
|
|
64
|
-
}
|
|
65
|
-
static get PUBLIC_BASE_URL_BACKEND_PRINCIPAL() {
|
|
66
|
-
return this.SET_PUBLIC_BASE_URL_BACKEND_PRINCIPAL?.trim();
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
/* export default */ const src_config_env = (config_env);
|
|
70
|
-
|
|
71
58
|
;// CONCATENATED MODULE: external "zod/v4"
|
|
72
59
|
const v4_namespaceObject = require("zod/v4");
|
|
73
60
|
var v4_default = /*#__PURE__*/__webpack_require__.n(v4_namespaceObject);
|
|
@@ -240,14 +227,31 @@ const _session_storage = class _session_storage {
|
|
|
240
227
|
;// CONCATENATED MODULE: ./src/utils/_api.ts
|
|
241
228
|
|
|
242
229
|
|
|
243
|
-
|
|
244
230
|
const _api_api = class _api {
|
|
245
231
|
static servidor_pricipal = class servidor_pricipal {
|
|
246
232
|
static get #axios() {
|
|
247
233
|
return external_axios_default().create({
|
|
248
|
-
baseURL:
|
|
234
|
+
baseURL: this.resolve_base_url()
|
|
249
235
|
});
|
|
250
236
|
}
|
|
237
|
+
static resolve_base_url() {
|
|
238
|
+
if (typeof window === "undefined") {
|
|
239
|
+
throw new Error("resolveApiBaseURL must run in browser");
|
|
240
|
+
}
|
|
241
|
+
const { hostname } = window.location;
|
|
242
|
+
if (hostname === "localhost" || hostname.startsWith("localhost")) {
|
|
243
|
+
return "http://localhost:8787";
|
|
244
|
+
}
|
|
245
|
+
const isNavSoftware = hostname.includes("navsoftware");
|
|
246
|
+
const isSandbox = hostname.includes("sandbox");
|
|
247
|
+
if (isNavSoftware && isSandbox) {
|
|
248
|
+
return "https://api-sandbox.navsoftware.com.br";
|
|
249
|
+
}
|
|
250
|
+
if (isNavSoftware) {
|
|
251
|
+
return "https://api.navsoftware.com.br";
|
|
252
|
+
}
|
|
253
|
+
throw new Error(`Ambiente não reconhecido: ${hostname}`);
|
|
254
|
+
}
|
|
251
255
|
static async post({ url, data, setToken = true }) {
|
|
252
256
|
return await this.#axios.post(url, data, _api.headers({
|
|
253
257
|
setToken: setToken
|
|
@@ -825,12 +829,10 @@ const utils = {
|
|
|
825
829
|
|
|
826
830
|
|
|
827
831
|
|
|
828
|
-
|
|
829
832
|
exports.TypesCore = __webpack_exports__.TypesCore;
|
|
830
|
-
exports.config_env_core = __webpack_exports__.config_env_core;
|
|
831
833
|
exports.utils = __webpack_exports__.utils;
|
|
832
834
|
for(var __rspack_i in __webpack_exports__) {
|
|
833
|
-
if(["TypesCore","
|
|
835
|
+
if(["TypesCore","utils"].indexOf(__rspack_i) === -1) {
|
|
834
836
|
exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
835
837
|
}
|
|
836
838
|
}
|
package/build/lib/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
interface TypesConfigEnv {
|
|
2
|
-
SET_PUBLIC_BASE_URL_BACKEND_PRINCIPAL: string;
|
|
3
|
-
}
|
|
4
|
-
declare class config_env {
|
|
5
|
-
private static SET_PUBLIC_BASE_URL_BACKEND_PRINCIPAL;
|
|
6
|
-
static init(config: TypesConfigEnv): void;
|
|
7
|
-
static get PUBLIC_BASE_URL_BACKEND_PRINCIPAL(): string;
|
|
8
|
-
}
|
|
9
|
-
export default config_env;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
interface TypesConfigEnv {
|
|
2
|
-
SET_PUBLIC_BASE_URL_BACKEND_PRINCIPAL: string;
|
|
3
|
-
}
|
|
4
|
-
declare class config_env {
|
|
5
|
-
private static SET_PUBLIC_BASE_URL_BACKEND_PRINCIPAL;
|
|
6
|
-
static init(config: TypesConfigEnv): void;
|
|
7
|
-
static get PUBLIC_BASE_URL_BACKEND_PRINCIPAL(): string;
|
|
8
|
-
}
|
|
9
|
-
export default config_env;
|