@base44/sdk 0.7.0 → 0.7.1

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.d.ts CHANGED
@@ -14,6 +14,7 @@ export declare function createClient(config: {
14
14
  token?: string;
15
15
  serviceToken?: string;
16
16
  requiresAuth?: boolean;
17
+ functionsVersion?: string;
17
18
  }): {
18
19
  /**
19
20
  * Set authentication token for all requests
package/dist/client.js CHANGED
@@ -16,12 +16,17 @@ import { createFunctionsModule } from "./modules/functions.js";
16
16
  * @returns {Object} Base44 client instance
17
17
  */
18
18
  export function createClient(config) {
19
- const { serverUrl = "https://base44.app", appId, token, serviceToken, requiresAuth = false, } = config;
19
+ const { serverUrl = "https://base44.app", appId, token, serviceToken, requiresAuth = false, functionsVersion } = config;
20
+ const headers = {
21
+ "X-App-Id": String(appId),
22
+ };
23
+ const functionHeaders = functionsVersion ? {
24
+ ...headers,
25
+ "Base44-Functions-Version": functionsVersion
26
+ } : headers;
20
27
  const axiosClient = createAxiosClient({
21
28
  baseURL: `${serverUrl}/api`,
22
- headers: {
23
- "X-App-Id": String(appId),
24
- },
29
+ headers,
25
30
  token,
26
31
  requiresAuth,
27
32
  appId,
@@ -29,9 +34,7 @@ export function createClient(config) {
29
34
  });
30
35
  const functionsAxiosClient = createAxiosClient({
31
36
  baseURL: `${serverUrl}/api`,
32
- headers: {
33
- "X-App-Id": String(appId),
34
- },
37
+ headers: functionHeaders,
35
38
  token,
36
39
  requiresAuth,
37
40
  appId,
@@ -40,18 +43,14 @@ export function createClient(config) {
40
43
  });
41
44
  const serviceRoleAxiosClient = createAxiosClient({
42
45
  baseURL: `${serverUrl}/api`,
43
- headers: {
44
- "X-App-Id": String(appId),
45
- },
46
+ headers,
46
47
  token: serviceToken,
47
48
  serverUrl,
48
49
  appId,
49
50
  });
50
51
  const serviceRoleFunctionsAxiosClient = createAxiosClient({
51
52
  baseURL: `${serverUrl}/api`,
52
- headers: {
53
- "X-App-Id": String(appId),
54
- },
53
+ headers: functionHeaders,
55
54
  token: serviceToken,
56
55
  serverUrl,
57
56
  appId,
@@ -132,6 +131,7 @@ export function createClientFromRequest(request) {
132
131
  const serviceRoleAuthHeader = request.headers.get("Base44-Service-Authorization");
133
132
  const appId = request.headers.get("Base44-App-Id");
134
133
  const serverUrlHeader = request.headers.get("Base44-Api-Url");
134
+ const functionsVersion = request.headers.get("Base44-Functions-Version");
135
135
  if (!appId) {
136
136
  throw new Error("Base44-App-Id header is required, but is was not found on the request");
137
137
  }
@@ -155,5 +155,6 @@ export function createClientFromRequest(request) {
155
155
  appId,
156
156
  token: userToken,
157
157
  serviceToken: serviceRoleToken,
158
+ functionsVersion: functionsVersion !== null && functionsVersion !== void 0 ? functionsVersion : undefined
158
159
  });
159
160
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@base44/sdk",
3
- "version": "0.7.0",
3
+ "version": "0.7.1",
4
4
  "description": "JavaScript SDK for Base44 API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",