@zerosls/clm-sdk 1.1.5 → 1.1.6
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/core/api-client.js +21 -16
- package/dist/core/legacy-api-client.js +1 -0
- package/dist/modules/legacy/classificationtypes/classificationtypes-api.js +1 -1
- package/package.json +1 -1
- package/src/core/api-client.ts +25 -22
- package/src/core/legacy-api-client.ts +1 -0
- package/src/modules/legacy/classificationtypes/classificationtypes-api.ts +1 -1
package/dist/core/api-client.js
CHANGED
|
@@ -62,27 +62,32 @@ export class ApiClient {
|
|
|
62
62
|
...(options.headers || {}),
|
|
63
63
|
});
|
|
64
64
|
const headers = new Headers(base);
|
|
65
|
-
const legacyPattern = /(^|\/)legacy(\/|$)/i;
|
|
66
|
-
const isLegacyEndpoint = legacyPattern.test(endpoint);
|
|
67
|
-
if (isLegacyEndpoint) {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
65
|
+
//const legacyPattern = /(^|\/)legacy(\/|$)/i;
|
|
66
|
+
//const isLegacyEndpoint = legacyPattern.test(endpoint);
|
|
67
|
+
//if (isLegacyEndpoint) {
|
|
68
|
+
const legacyToken = window.__LEGACY_TOKEN__ ||
|
|
69
|
+
sessionStorage.getItem("legacy_token") ||
|
|
70
|
+
null;
|
|
71
|
+
if (legacyToken) {
|
|
72
|
+
headers.set("Authorization", `Bearer ${legacyToken}`);
|
|
73
|
+
if (this.debug) {
|
|
74
|
+
console.log("🔐 Using legacy token for:", endpoint);
|
|
76
75
|
}
|
|
77
|
-
|
|
78
|
-
|
|
76
|
+
}
|
|
77
|
+
else if (this.token) {
|
|
78
|
+
// ✅ Si no hay legacy token, usar token v1
|
|
79
|
+
if (this.debug) {
|
|
80
|
+
console.log("🔐 Using v1 token for:", endpoint);
|
|
79
81
|
}
|
|
80
82
|
}
|
|
81
83
|
else {
|
|
82
|
-
|
|
83
|
-
headers.delete("Authorization");
|
|
84
|
-
}
|
|
84
|
+
console.warn("⚠️ No token available for endpoint:", endpoint);
|
|
85
85
|
}
|
|
86
|
+
//} else {
|
|
87
|
+
// if (!this.token) {
|
|
88
|
+
// headers.delete("Authorization");
|
|
89
|
+
// }
|
|
90
|
+
//}
|
|
86
91
|
const useCache = this.cacheEnabled && options.useCache !== false;
|
|
87
92
|
if (useCache && method === "GET") {
|
|
88
93
|
const cacheKey = generateCacheKey(method, url, data);
|
package/package.json
CHANGED
package/src/core/api-client.ts
CHANGED
|
@@ -138,33 +138,36 @@ export class ApiClient {
|
|
|
138
138
|
|
|
139
139
|
const headers = new Headers(base);
|
|
140
140
|
|
|
141
|
-
const legacyPattern = /(^|\/)legacy(\/|$)/i;
|
|
142
|
-
const isLegacyEndpoint = legacyPattern.test(endpoint);
|
|
143
|
-
|
|
144
|
-
if (isLegacyEndpoint) {
|
|
145
|
-
const legacyToken =
|
|
146
|
-
(window as any).__LEGACY_TOKEN__ ||
|
|
147
|
-
sessionStorage.getItem("legacy_token") ||
|
|
148
|
-
null;
|
|
149
|
-
|
|
150
|
-
if (legacyToken) {
|
|
151
|
-
headers.set("Authorization", `Bearer ${legacyToken}`);
|
|
141
|
+
//const legacyPattern = /(^|\/)legacy(\/|$)/i;
|
|
142
|
+
//const isLegacyEndpoint = legacyPattern.test(endpoint);
|
|
152
143
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
144
|
+
//if (isLegacyEndpoint) {
|
|
145
|
+
const legacyToken =
|
|
146
|
+
(window as any).__LEGACY_TOKEN__ ||
|
|
147
|
+
sessionStorage.getItem("legacy_token") ||
|
|
148
|
+
null;
|
|
149
|
+
|
|
150
|
+
if (legacyToken) {
|
|
151
|
+
headers.set("Authorization", `Bearer ${legacyToken}`);
|
|
152
|
+
|
|
153
|
+
if (this.debug) {
|
|
154
|
+
console.log("🔐 Using legacy token for:", endpoint);
|
|
161
155
|
}
|
|
162
|
-
} else {
|
|
163
|
-
|
|
164
|
-
|
|
156
|
+
} else if (this.token) {
|
|
157
|
+
// ✅ Si no hay legacy token, usar token v1
|
|
158
|
+
if (this.debug) {
|
|
159
|
+
console.log("🔐 Using v1 token for:", endpoint);
|
|
165
160
|
}
|
|
161
|
+
} else {
|
|
162
|
+
console.warn("⚠️ No token available for endpoint:", endpoint);
|
|
166
163
|
}
|
|
167
164
|
|
|
165
|
+
//} else {
|
|
166
|
+
// if (!this.token) {
|
|
167
|
+
// headers.delete("Authorization");
|
|
168
|
+
// }
|
|
169
|
+
//}
|
|
170
|
+
|
|
168
171
|
const useCache = this.cacheEnabled && options.useCache !== false;
|
|
169
172
|
if (useCache && method === "GET") {
|
|
170
173
|
const cacheKey = generateCacheKey(method, url, data);
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
|
|
11
11
|
export class ClassificationTypesApi {
|
|
12
12
|
private apiClient: ApiClient;
|
|
13
|
-
private readonly basePath = "/
|
|
13
|
+
private readonly basePath = "/catalog/clasificationtype";
|
|
14
14
|
|
|
15
15
|
constructor(apiClient: ApiClient) {
|
|
16
16
|
this.apiClient = apiClient;
|