@base44-preview/sdk 0.8.10-pr.62.8f72a2c → 0.8.10-pr.62.fa928f8
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,16 @@ 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
|
-
// Normalize parameters to snake_case
|
|
52
|
-
const normalizedParams = normalizeParams(params);
|
|
53
19
|
// Make the API call
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
//
|
|
20
|
+
// Note: axios interceptor extracts response.data, so we get the payload directly
|
|
21
|
+
const response = await axios.post(`/apps/${appId}/integrations/custom/${slug}/${operationId}`, params !== null && params !== void 0 ? params : {});
|
|
22
|
+
// The axios interceptor extracts response.data, so we get the payload directly
|
|
57
23
|
return response;
|
|
58
24
|
},
|
|
59
25
|
};
|
|
@@ -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,22 +8,10 @@ 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
|
-
*/
|
|
16
|
-
pathParams?: Record<string, string>;
|
|
17
|
-
/**
|
|
18
|
-
* Path parameters to substitute in the URL (snake_case variant).
|
|
19
|
-
* @see {@link pathParams}
|
|
20
11
|
*/
|
|
21
12
|
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
|
-
*/
|
|
26
|
-
queryParams?: Record<string, any>;
|
|
27
|
-
/**
|
|
28
|
-
* Query string parameters (snake_case variant).
|
|
29
|
-
* @see {@link queryParams}
|
|
30
15
|
*/
|
|
31
16
|
query_params?: Record<string, any>;
|
|
32
17
|
/**
|
|
@@ -72,8 +57,8 @@ export interface CustomIntegrationCallResponse {
|
|
|
72
57
|
* "github", // integration slug (defined by workspace admin)
|
|
73
58
|
* "listIssues", // operation ID from the OpenAPI spec
|
|
74
59
|
* {
|
|
75
|
-
*
|
|
76
|
-
*
|
|
60
|
+
* path_params: { owner: "myorg", repo: "myrepo" },
|
|
61
|
+
* query_params: { state: "open", per_page: 100 }
|
|
77
62
|
* }
|
|
78
63
|
* );
|
|
79
64
|
*
|
|
@@ -91,7 +76,7 @@ export interface CustomIntegrationCallResponse {
|
|
|
91
76
|
* "github",
|
|
92
77
|
* "createIssue",
|
|
93
78
|
* {
|
|
94
|
-
*
|
|
79
|
+
* path_params: { owner: "myorg", repo: "myrepo" },
|
|
95
80
|
* payload: {
|
|
96
81
|
* title: "Bug report",
|
|
97
82
|
* body: "Something is broken",
|