@base44-preview/sdk 0.8.10-pr.62.8f72a2c → 0.8.11-pr.63.10884cf
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.
|
@@ -1,35 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Normalizes parameters to snake_case for the API.
|
|
3
|
-
*
|
|
4
|
-
* Supports both camelCase (pathParams) and snake_case (path_params) input,
|
|
5
|
-
* always outputting snake_case for the backend.
|
|
6
|
-
*/
|
|
7
|
-
function normalizeParams(params) {
|
|
8
|
-
var _a, _b;
|
|
9
|
-
if (!params) {
|
|
10
|
-
return {};
|
|
11
|
-
}
|
|
12
|
-
const normalized = {};
|
|
13
|
-
// Handle payload
|
|
14
|
-
if (params.payload !== undefined) {
|
|
15
|
-
normalized.payload = params.payload;
|
|
16
|
-
}
|
|
17
|
-
// Handle path_params (support both camelCase and snake_case)
|
|
18
|
-
const pathParams = (_a = params.pathParams) !== null && _a !== void 0 ? _a : params.path_params;
|
|
19
|
-
if (pathParams !== undefined) {
|
|
20
|
-
normalized.path_params = pathParams;
|
|
21
|
-
}
|
|
22
|
-
// Handle query_params (support both camelCase and snake_case)
|
|
23
|
-
const queryParams = (_b = params.queryParams) !== null && _b !== void 0 ? _b : params.query_params;
|
|
24
|
-
if (queryParams !== undefined) {
|
|
25
|
-
normalized.query_params = queryParams;
|
|
26
|
-
}
|
|
27
|
-
// Handle headers
|
|
28
|
-
if (params.headers !== undefined) {
|
|
29
|
-
normalized.headers = params.headers;
|
|
30
|
-
}
|
|
31
|
-
return normalized;
|
|
32
|
-
}
|
|
33
1
|
/**
|
|
34
2
|
* Creates the custom integrations module for the Base44 SDK.
|
|
35
3
|
*
|
|
@@ -42,18 +10,22 @@ export function createCustomIntegrationsModule(axios, appId) {
|
|
|
42
10
|
return {
|
|
43
11
|
async call(slug, operationId, params) {
|
|
44
12
|
// Validate required parameters
|
|
45
|
-
if (!slug) {
|
|
46
|
-
throw new Error("Integration slug is required");
|
|
13
|
+
if (!(slug === null || slug === void 0 ? void 0 : slug.trim())) {
|
|
14
|
+
throw new Error("Integration slug is required and cannot be empty");
|
|
47
15
|
}
|
|
48
|
-
if (!operationId) {
|
|
49
|
-
throw new Error("Operation ID is required");
|
|
16
|
+
if (!(operationId === null || operationId === void 0 ? void 0 : operationId.trim())) {
|
|
17
|
+
throw new Error("Operation ID is required and cannot be empty");
|
|
50
18
|
}
|
|
51
|
-
//
|
|
52
|
-
const
|
|
19
|
+
// Convert camelCase to snake_case for Python backend
|
|
20
|
+
const { pathParams, queryParams, ...rest } = params !== null && params !== void 0 ? params : {};
|
|
21
|
+
const body = {
|
|
22
|
+
...rest,
|
|
23
|
+
...(pathParams && { path_params: pathParams }),
|
|
24
|
+
...(queryParams && { query_params: queryParams }),
|
|
25
|
+
};
|
|
53
26
|
// Make the API call
|
|
54
|
-
const response = await axios.post(`/apps/${appId}/integrations/custom/${slug}/${operationId}`,
|
|
55
|
-
//
|
|
56
|
-
// Note: axios interceptor already extracts data from response
|
|
27
|
+
const response = await axios.post(`/apps/${appId}/integrations/custom/${slug}/${operationId}`, body);
|
|
28
|
+
// The axios interceptor extracts response.data, so we get the payload directly
|
|
57
29
|
return response;
|
|
58
30
|
},
|
|
59
31
|
};
|
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Parameters for calling a custom integration endpoint.
|
|
3
|
-
*
|
|
4
|
-
* Supports both camelCase and snake_case parameter names for developer convenience.
|
|
5
|
-
* The SDK will normalize to snake_case before sending to the API.
|
|
6
3
|
*/
|
|
7
4
|
export interface CustomIntegrationCallParams {
|
|
8
5
|
/**
|
|
@@ -11,24 +8,12 @@ export interface CustomIntegrationCallParams {
|
|
|
11
8
|
payload?: Record<string, any>;
|
|
12
9
|
/**
|
|
13
10
|
* Path parameters to substitute in the URL (e.g., `{ owner: "user", repo: "repo" }`).
|
|
14
|
-
* Can use either `pathParams` (camelCase) or `path_params` (snake_case).
|
|
15
11
|
*/
|
|
16
12
|
pathParams?: Record<string, string>;
|
|
17
|
-
/**
|
|
18
|
-
* Path parameters to substitute in the URL (snake_case variant).
|
|
19
|
-
* @see {@link pathParams}
|
|
20
|
-
*/
|
|
21
|
-
path_params?: Record<string, string>;
|
|
22
13
|
/**
|
|
23
14
|
* Query string parameters to append to the URL.
|
|
24
|
-
* Can use either `queryParams` (camelCase) or `query_params` (snake_case).
|
|
25
15
|
*/
|
|
26
16
|
queryParams?: Record<string, any>;
|
|
27
|
-
/**
|
|
28
|
-
* Query string parameters (snake_case variant).
|
|
29
|
-
* @see {@link queryParams}
|
|
30
|
-
*/
|
|
31
|
-
query_params?: Record<string, any>;
|
|
32
17
|
/**
|
|
33
18
|
* Additional headers to send with this specific request.
|
|
34
19
|
* These are merged with the integration's configured headers.
|
|
@@ -107,7 +92,7 @@ export interface CustomIntegrationsModule {
|
|
|
107
92
|
*
|
|
108
93
|
* @param slug - The integration's unique identifier (slug), as defined by the workspace admin.
|
|
109
94
|
* @param operationId - The operation ID from the OpenAPI spec (e.g., "listIssues", "getUser").
|
|
110
|
-
* @param params - Optional parameters including payload,
|
|
95
|
+
* @param params - Optional parameters including payload, pathParams, queryParams, and headers.
|
|
111
96
|
* @returns Promise resolving to the integration call response.
|
|
112
97
|
*
|
|
113
98
|
* @throws {Error} If slug is not provided.
|
package/dist/modules/entities.js
CHANGED
|
@@ -32,6 +32,13 @@ export function createEntitiesModule(axios, appId) {
|
|
|
32
32
|
*/
|
|
33
33
|
function createEntityHandler(axios, appId, entityName) {
|
|
34
34
|
const baseURL = `/apps/${appId}/entities/${entityName}`;
|
|
35
|
+
const isDevMode = new URLSearchParams(window.location.search).get("use_dev_table") === "true";
|
|
36
|
+
axios.interceptors.request.use((config) => {
|
|
37
|
+
var _a;
|
|
38
|
+
config.headers = (_a = config.headers) !== null && _a !== void 0 ? _a : {};
|
|
39
|
+
config.headers["X-Dev-Mode"] = String(isDevMode);
|
|
40
|
+
return config;
|
|
41
|
+
});
|
|
35
42
|
return {
|
|
36
43
|
// List entities with optional pagination and sorting
|
|
37
44
|
async list(sort, limit, skip, fields) {
|