skedyul 0.1.56 → 0.1.57
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/.build-stamp +1 -1
- package/dist/core/client.js +21 -2
- package/package.json +1 -1
package/dist/.build-stamp
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
1768866960766
|
package/dist/core/client.js
CHANGED
|
@@ -81,7 +81,15 @@ function getConfig() {
|
|
|
81
81
|
// Core API Client
|
|
82
82
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
83
83
|
async function callCore(method, params) {
|
|
84
|
-
const
|
|
84
|
+
const effectiveConfig = getEffectiveConfig();
|
|
85
|
+
const { baseUrl, apiToken } = effectiveConfig;
|
|
86
|
+
// Debug logging to trace config resolution
|
|
87
|
+
const requestConfig = requestConfigStorage.getStore();
|
|
88
|
+
console.log('\n🔍 callCore config resolution:');
|
|
89
|
+
console.log(' Method:', method);
|
|
90
|
+
console.log(' Request-scoped config:', requestConfig ? { baseUrl: requestConfig.baseUrl, apiToken: requestConfig.apiToken ? '(set)' : '(empty)' } : '(none)');
|
|
91
|
+
console.log(' Global config:', { baseUrl: globalConfig.baseUrl, apiToken: globalConfig.apiToken ? '(set)' : '(empty)' });
|
|
92
|
+
console.log(' Effective config:', { baseUrl, apiToken: apiToken ? '(set)' : '(empty)' });
|
|
85
93
|
if (!baseUrl) {
|
|
86
94
|
throw new Error('Skedyul client not configured: missing baseUrl. Set SKEDYUL_API_URL environment variable or call configure().');
|
|
87
95
|
}
|
|
@@ -92,11 +100,22 @@ async function callCore(method, params) {
|
|
|
92
100
|
'Content-Type': 'application/json',
|
|
93
101
|
Authorization: `Bearer ${apiToken}`,
|
|
94
102
|
};
|
|
95
|
-
const
|
|
103
|
+
const fetchUrl = `${baseUrl}/core`;
|
|
104
|
+
console.log(' Fetching:', fetchUrl);
|
|
105
|
+
const response = await fetch(fetchUrl, {
|
|
96
106
|
method: 'POST',
|
|
97
107
|
headers,
|
|
98
108
|
body: JSON.stringify({ method, params }),
|
|
99
109
|
});
|
|
110
|
+
console.log(' Response status:', response.status);
|
|
111
|
+
// Check content-type before parsing
|
|
112
|
+
const contentType = response.headers.get('content-type') ?? '';
|
|
113
|
+
if (!contentType.includes('application/json')) {
|
|
114
|
+
const text = await response.text();
|
|
115
|
+
console.log(' Response content-type:', contentType);
|
|
116
|
+
console.log(' Response body (first 200 chars):', text.slice(0, 200));
|
|
117
|
+
throw new Error(`Core API returned non-JSON response (${response.status}): ${text.slice(0, 100)}`);
|
|
118
|
+
}
|
|
100
119
|
const payload = (await response.json());
|
|
101
120
|
if (!response.ok) {
|
|
102
121
|
throw new Error(payload?.error?.message ?? `Core API error (${response.status})`);
|