@zerosls/clm-sdk 1.1.10 → 2.1.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/dist/config/config.js +5 -7
- package/dist/core/api-client.js +19 -0
- package/dist/modules/legacy/classificationtypes/classificationtypes-api.js +1 -1
- package/package.json +1 -1
- package/src/config/config.ts +5 -5
- package/src/core/api-client.ts +24 -0
- package/src/modules/legacy/classificationtypes/classificationtypes-api.ts +1 -1
package/dist/config/config.js
CHANGED
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
function normalizeUrl(url) {
|
|
2
2
|
return url.trim().replace(/\/+$/, "");
|
|
3
3
|
}
|
|
4
|
-
function resolveDefaultBaseUrl()
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return normalizeUrl(String(fromWindow));
|
|
9
|
-
}
|
|
4
|
+
//function resolveDefaultBaseUrl(){
|
|
5
|
+
// const fromWindow = (globalThis as any)?.SDK_CONFIG?.API_BASE_URL;
|
|
6
|
+
// if (fromWindow) return normalizeUrl(String(fromWindow));
|
|
7
|
+
//}
|
|
10
8
|
export const DEFAULT_CONFIG = {
|
|
11
|
-
baseUrl: resolveDefaultBaseUrl(),
|
|
9
|
+
baseUrl: "https://zero-api-qa.onrender.com/api/v1", //resolveDefaultBaseUrl(),
|
|
12
10
|
organization: "default-org",
|
|
13
11
|
cache: { enabled: true, ttl: 60000 },
|
|
14
12
|
debug: true,
|
package/dist/core/api-client.js
CHANGED
|
@@ -93,6 +93,14 @@ export class ApiClient {
|
|
|
93
93
|
method,
|
|
94
94
|
data,
|
|
95
95
|
});
|
|
96
|
+
// Colocado
|
|
97
|
+
if (this.debug) {
|
|
98
|
+
console.log("🍪 Cookies Debug:", {
|
|
99
|
+
credentials: this.credentials,
|
|
100
|
+
documentCookie: typeof document !== "undefined" ? document.cookie : "N/A",
|
|
101
|
+
url: url,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
96
104
|
try {
|
|
97
105
|
const fetchOptions = {
|
|
98
106
|
method,
|
|
@@ -104,7 +112,18 @@ export class ApiClient {
|
|
|
104
112
|
console.log(`📤 ${method} Body:`, data);
|
|
105
113
|
}
|
|
106
114
|
console.log(`🌐 ${method} ${url}`, fetchOptions);
|
|
115
|
+
// Colocado
|
|
116
|
+
console.log(`🌐 ${method} ${url}`, {
|
|
117
|
+
...fetchOptions,
|
|
118
|
+
cookieHeader: headers.get("Cookie"),
|
|
119
|
+
});
|
|
107
120
|
const response = await fetch(url, fetchOptions);
|
|
121
|
+
// Colocado
|
|
122
|
+
if (this.debug) {
|
|
123
|
+
console.log("📥 Response Headers:", {
|
|
124
|
+
setCookie: response.headers.get("Set-Cookie"),
|
|
125
|
+
});
|
|
126
|
+
}
|
|
108
127
|
if (!response.ok) {
|
|
109
128
|
let errorData;
|
|
110
129
|
try {
|
package/package.json
CHANGED
package/src/config/config.ts
CHANGED
|
@@ -4,13 +4,13 @@ function normalizeUrl(url: string) {
|
|
|
4
4
|
return url.trim().replace(/\/+$/, "");
|
|
5
5
|
}
|
|
6
6
|
|
|
7
|
-
function resolveDefaultBaseUrl(){
|
|
8
|
-
const fromWindow = (globalThis as any)?.SDK_CONFIG?.API_BASE_URL;
|
|
9
|
-
if (fromWindow) return normalizeUrl(String(fromWindow));
|
|
10
|
-
}
|
|
7
|
+
//function resolveDefaultBaseUrl(){
|
|
8
|
+
// const fromWindow = (globalThis as any)?.SDK_CONFIG?.API_BASE_URL;
|
|
9
|
+
// if (fromWindow) return normalizeUrl(String(fromWindow));
|
|
10
|
+
//}
|
|
11
11
|
|
|
12
12
|
export const DEFAULT_CONFIG: Partial<SdkConfig> = {
|
|
13
|
-
baseUrl: resolveDefaultBaseUrl(),
|
|
13
|
+
baseUrl: "https://zero-api-qa.onrender.com/api/v1", //resolveDefaultBaseUrl(),
|
|
14
14
|
organization: "default-org",
|
|
15
15
|
cache: { enabled: true, ttl: 60000 },
|
|
16
16
|
debug: true,
|
package/src/core/api-client.ts
CHANGED
|
@@ -176,6 +176,16 @@ export class ApiClient {
|
|
|
176
176
|
data,
|
|
177
177
|
});
|
|
178
178
|
|
|
179
|
+
// Colocado
|
|
180
|
+
if (this.debug) {
|
|
181
|
+
console.log("🍪 Cookies Debug:", {
|
|
182
|
+
credentials: this.credentials,
|
|
183
|
+
documentCookie:
|
|
184
|
+
typeof document !== "undefined" ? document.cookie : "N/A",
|
|
185
|
+
url: url,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
179
189
|
try {
|
|
180
190
|
const fetchOptions: RequestInit = {
|
|
181
191
|
method,
|
|
@@ -189,8 +199,22 @@ export class ApiClient {
|
|
|
189
199
|
}
|
|
190
200
|
|
|
191
201
|
console.log(`🌐 ${method} ${url}`, fetchOptions);
|
|
202
|
+
|
|
203
|
+
// Colocado
|
|
204
|
+
console.log(`🌐 ${method} ${url}`, {
|
|
205
|
+
...fetchOptions,
|
|
206
|
+
cookieHeader: headers.get("Cookie"),
|
|
207
|
+
});
|
|
208
|
+
|
|
192
209
|
const response = await fetch(url, fetchOptions);
|
|
193
210
|
|
|
211
|
+
// Colocado
|
|
212
|
+
if (this.debug) {
|
|
213
|
+
console.log("📥 Response Headers:", {
|
|
214
|
+
setCookie: response.headers.get("Set-Cookie"),
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
|
|
194
218
|
if (!response.ok) {
|
|
195
219
|
let errorData;
|
|
196
220
|
try {
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
|
|
11
11
|
export class ClassificationTypesApi {
|
|
12
12
|
private apiClient: ApiClient;
|
|
13
|
-
private readonly basePath = "/catalog/clasificationtype";
|
|
13
|
+
private readonly basePath = "/legacy/catalog/clasificationtype";
|
|
14
14
|
|
|
15
15
|
constructor(apiClient: ApiClient) {
|
|
16
16
|
this.apiClient = apiClient;
|