@base44-preview/sdk 0.8.20-pr.141.9c6fda7 → 0.8.20-pr.141.a5b2329
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/client.js +7 -16
- package/dist/modules/functions.js +1 -1
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -118,15 +118,11 @@ export function createClient(config) {
|
|
|
118
118
|
auth: userAuthModule,
|
|
119
119
|
functions: createFunctionsModule(functionsAxiosClient, appId, {
|
|
120
120
|
getAuthHeaders: () => {
|
|
121
|
-
var _a, _b;
|
|
122
121
|
const headers = {};
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
headers[key] = value;
|
|
128
|
-
}
|
|
129
|
-
});
|
|
122
|
+
// Get current token from storage or initial config
|
|
123
|
+
const currentToken = token || getAccessToken();
|
|
124
|
+
if (currentToken) {
|
|
125
|
+
headers["Authorization"] = `Bearer ${currentToken}`;
|
|
130
126
|
}
|
|
131
127
|
return headers;
|
|
132
128
|
},
|
|
@@ -165,15 +161,10 @@ export function createClient(config) {
|
|
|
165
161
|
connectors: createConnectorsModule(serviceRoleAxiosClient, appId),
|
|
166
162
|
functions: createFunctionsModule(serviceRoleFunctionsAxiosClient, appId, {
|
|
167
163
|
getAuthHeaders: () => {
|
|
168
|
-
var _a, _b;
|
|
169
164
|
const headers = {};
|
|
170
|
-
|
|
171
|
-
if (
|
|
172
|
-
|
|
173
|
-
if (typeof value === 'string') {
|
|
174
|
-
headers[key] = value;
|
|
175
|
-
}
|
|
176
|
-
});
|
|
165
|
+
// Use service token for authorization
|
|
166
|
+
if (serviceToken) {
|
|
167
|
+
headers["Authorization"] = `Bearer ${serviceToken}`;
|
|
177
168
|
}
|
|
178
169
|
return headers;
|
|
179
170
|
},
|
|
@@ -63,7 +63,7 @@ export function createFunctionsModule(axios, appId, config) {
|
|
|
63
63
|
}
|
|
64
64
|
return axios.post(`/apps/${appId}/functions/${functionName}`, formData || data, { headers: { "Content-Type": contentType } });
|
|
65
65
|
},
|
|
66
|
-
// Fetch a backend function endpoint directly
|
|
66
|
+
// Fetch a backend function endpoint directly.
|
|
67
67
|
async fetch(path, init = {}) {
|
|
68
68
|
const normalizedPath = path.startsWith("/") ? path : `/${path}`;
|
|
69
69
|
const primaryPath = `/functions${normalizedPath}`;
|