@base44-preview/sdk 0.8.32-pr.198.9e03952 → 0.8.32-pr.201.be55f9b
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.
|
@@ -80,11 +80,13 @@ export interface AppUserConnectorConnectionResponse {
|
|
|
80
80
|
* | Calendly | `calendly` |
|
|
81
81
|
* | ClickUp | `clickup` |
|
|
82
82
|
* | Contentful | `contentful` |
|
|
83
|
+
* | Databricks | `databricks` |
|
|
83
84
|
* | Discord | `discord` |
|
|
84
85
|
* | Dropbox | `dropbox` |
|
|
85
86
|
* | GitHub | `github` |
|
|
86
87
|
* | GitLab | `gitlab` |
|
|
87
88
|
* | Gmail | `gmail` |
|
|
89
|
+
* | Google Ads | `googleads` |
|
|
88
90
|
* | Google Analytics | `google_analytics` |
|
|
89
91
|
* | Google BigQuery | `googlebigquery` |
|
|
90
92
|
* | Google Calendar | `googlecalendar` |
|
|
@@ -105,10 +107,12 @@ export interface AppUserConnectorConnectionResponse {
|
|
|
105
107
|
* | Microsoft OneDrive | `one_drive` |
|
|
106
108
|
* | Notion | `notion` |
|
|
107
109
|
* | Outlook | `outlook` |
|
|
110
|
+
* | QuickBooks | `quickbooks` |
|
|
108
111
|
* | Salesforce | `salesforce` |
|
|
109
112
|
* | SharePoint | `share_point` |
|
|
110
113
|
* | Slack User | `slack` |
|
|
111
114
|
* | Slack Bot | `slackbot` |
|
|
115
|
+
* | Snowflake | `snowflake` |
|
|
112
116
|
* | Splitwise | `splitwise` |
|
|
113
117
|
* | Supabase | `supabase` |
|
|
114
118
|
* | TikTok | `tiktok` |
|
|
@@ -43,9 +43,9 @@ export interface InvokeLLMParams {
|
|
|
43
43
|
prompt: string;
|
|
44
44
|
/** Optionally specify a model to override the app-level model setting for this specific call.
|
|
45
45
|
*
|
|
46
|
-
* Options: `"gpt_5_mini"`, `"gemini_3_flash"`, `"
|
|
46
|
+
* Options: `"gpt_5_mini"`, `"gemini_3_flash"`, `"gpt_5_4"`, `"gpt_5_5"`, `"gemini_3_1_pro"`, `"claude_sonnet_4_6"`, `"claude_opus_4_6"`, `"claude_opus_4_7"`, `"claude_opus_4_8"`
|
|
47
47
|
*/
|
|
48
|
-
model?: 'gpt_5_mini' | 'gemini_3_flash' | '
|
|
48
|
+
model?: 'gpt_5_mini' | 'gemini_3_flash' | 'gpt_5_4' | 'gpt_5_5' | 'gemini_3_1_pro' | 'claude_sonnet_4_6' | 'claude_opus_4_6' | 'claude_opus_4_7' | 'claude_opus_4_8';
|
|
49
49
|
/** If set to `true`, the LLM will use Google Search, Maps, and News to gather real-time context before answering.
|
|
50
50
|
* @default false
|
|
51
51
|
*/
|
|
@@ -76,6 +76,14 @@ export declare class Base44Error extends Error {
|
|
|
76
76
|
*/
|
|
77
77
|
toJSON(): Base44ErrorJSON;
|
|
78
78
|
}
|
|
79
|
+
/**
|
|
80
|
+
* Convert an arbitrary value into something the structured clone algorithm
|
|
81
|
+
* (used by `postMessage`) can always serialize. Request/response bodies may
|
|
82
|
+
* contain functions, streams, or other host objects that make `postMessage`
|
|
83
|
+
* throw a `DataCloneError`; a JSON round-trip drops those, and a string
|
|
84
|
+
* fallback covers circular references.
|
|
85
|
+
*/
|
|
86
|
+
export declare function toSerializable(value: unknown): unknown;
|
|
79
87
|
/**
|
|
80
88
|
* Creates an axios client with default configuration and interceptors.
|
|
81
89
|
*
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
2
|
import { isInIFrame } from "./common.js";
|
|
3
3
|
import { v4 as uuidv4 } from "uuid";
|
|
4
|
-
import { getOrCreateAnonymousVisitorId } from "./anon-visitor.js";
|
|
5
4
|
/**
|
|
6
5
|
* Custom error class for Base44 SDK errors.
|
|
7
6
|
*
|
|
@@ -101,6 +100,60 @@ function safeErrorLog(prefix, error) {
|
|
|
101
100
|
console.error(`${prefix} ${error instanceof Error ? error.message : String(error)}`);
|
|
102
101
|
}
|
|
103
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Convert an arbitrary value into something the structured clone algorithm
|
|
105
|
+
* (used by `postMessage`) can always serialize. Request/response bodies may
|
|
106
|
+
* contain functions, streams, or other host objects that make `postMessage`
|
|
107
|
+
* throw a `DataCloneError`; a JSON round-trip drops those, and a string
|
|
108
|
+
* fallback covers circular references.
|
|
109
|
+
*/
|
|
110
|
+
export function toSerializable(value) {
|
|
111
|
+
if (value === null || value === undefined)
|
|
112
|
+
return value;
|
|
113
|
+
const type = typeof value;
|
|
114
|
+
if (type === "string" || type === "number" || type === "boolean")
|
|
115
|
+
return value;
|
|
116
|
+
try {
|
|
117
|
+
return JSON.parse(JSON.stringify(value));
|
|
118
|
+
}
|
|
119
|
+
catch (_a) {
|
|
120
|
+
try {
|
|
121
|
+
return String(value);
|
|
122
|
+
}
|
|
123
|
+
catch (_b) {
|
|
124
|
+
return "[unserializable]";
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Post a request-activity message to the parent window (the host builder's
|
|
130
|
+
* Activity Monitor). Posting the raw bodies can throw a `DataCloneError` when
|
|
131
|
+
* they aren't structured-cloneable; if that happens we retry with a sanitized
|
|
132
|
+
* payload so the start/end status is never lost. A dropped `api-request-end`
|
|
133
|
+
* leaves the Activity Monitor stuck on "Pending" for a request that actually
|
|
134
|
+
* completed (e.g. a backend function returning 200).
|
|
135
|
+
*/
|
|
136
|
+
function postActivityMessage(message) {
|
|
137
|
+
var _a;
|
|
138
|
+
if (!isInIFrame)
|
|
139
|
+
return;
|
|
140
|
+
try {
|
|
141
|
+
window.parent.postMessage(message, "*");
|
|
142
|
+
}
|
|
143
|
+
catch (_b) {
|
|
144
|
+
try {
|
|
145
|
+
window.parent.postMessage({ ...message, data: toSerializable(message.data) }, "*");
|
|
146
|
+
}
|
|
147
|
+
catch (_c) {
|
|
148
|
+
// Drop the bodies entirely but still deliver the status signal.
|
|
149
|
+
window.parent.postMessage({
|
|
150
|
+
type: message.type,
|
|
151
|
+
requestId: message.requestId,
|
|
152
|
+
data: { statusCode: (_a = message.data) === null || _a === void 0 ? void 0 : _a.statusCode },
|
|
153
|
+
}, "*");
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
104
157
|
/**
|
|
105
158
|
* Creates an axios client with default configuration and interceptors.
|
|
106
159
|
*
|
|
@@ -132,36 +185,18 @@ export function createAxiosClient({ baseURL, headers = {}, token, interceptRespo
|
|
|
132
185
|
client.interceptors.request.use((config) => {
|
|
133
186
|
if (typeof window !== "undefined") {
|
|
134
187
|
config.headers.set("X-Origin-URL", window.location.href);
|
|
135
|
-
// On unauthenticated clients, attach a stable anonymous visitor id so the
|
|
136
|
-
// backend can support anonymous agent access (conversation grouping +
|
|
137
|
-
// ownership). Authenticated clients are identified by their token instead.
|
|
138
|
-
if (!token) {
|
|
139
|
-
const anonymousVisitorId = getOrCreateAnonymousVisitorId();
|
|
140
|
-
if (anonymousVisitorId) {
|
|
141
|
-
config.headers.set("X-Base44-Anonymous-Id", anonymousVisitorId);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
188
|
}
|
|
145
189
|
const requestId = uuidv4();
|
|
146
190
|
config.requestId = requestId;
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
? "[FormData object]"
|
|
157
|
-
: config.data,
|
|
158
|
-
},
|
|
159
|
-
}, "*");
|
|
160
|
-
}
|
|
161
|
-
catch (_a) {
|
|
162
|
-
/* skip the logging */
|
|
163
|
-
}
|
|
164
|
-
}
|
|
191
|
+
postActivityMessage({
|
|
192
|
+
type: "api-request-start",
|
|
193
|
+
requestId,
|
|
194
|
+
data: {
|
|
195
|
+
url: baseURL + config.url,
|
|
196
|
+
method: config.method,
|
|
197
|
+
body: config.data instanceof FormData ? "[FormData object]" : config.data,
|
|
198
|
+
},
|
|
199
|
+
});
|
|
165
200
|
return config;
|
|
166
201
|
});
|
|
167
202
|
// Handle responses
|
|
@@ -169,28 +204,36 @@ export function createAxiosClient({ baseURL, headers = {}, token, interceptRespo
|
|
|
169
204
|
client.interceptors.response.use((response) => {
|
|
170
205
|
var _a;
|
|
171
206
|
const requestId = (_a = response.config) === null || _a === void 0 ? void 0 : _a.requestId;
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}, "*");
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
catch (_b) {
|
|
185
|
-
/* do nothing */
|
|
207
|
+
if (requestId) {
|
|
208
|
+
postActivityMessage({
|
|
209
|
+
type: "api-request-end",
|
|
210
|
+
requestId,
|
|
211
|
+
data: {
|
|
212
|
+
statusCode: response.status,
|
|
213
|
+
response: response.data,
|
|
214
|
+
},
|
|
215
|
+
});
|
|
186
216
|
}
|
|
187
217
|
return response.data;
|
|
188
218
|
}, (error) => {
|
|
189
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
190
|
-
|
|
191
|
-
|
|
219
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
220
|
+
// Resolve the Activity Monitor entry on failure too, so a failed
|
|
221
|
+
// request doesn't stay stuck on "Pending".
|
|
222
|
+
const requestId = (_a = error.config) === null || _a === void 0 ? void 0 : _a.requestId;
|
|
223
|
+
if (requestId) {
|
|
224
|
+
postActivityMessage({
|
|
225
|
+
type: "api-request-end",
|
|
226
|
+
requestId,
|
|
227
|
+
data: {
|
|
228
|
+
statusCode: (_c = (_b = error.response) === null || _b === void 0 ? void 0 : _b.status) !== null && _c !== void 0 ? _c : 0,
|
|
229
|
+
response: (_e = (_d = error.response) === null || _d === void 0 ? void 0 : _d.data) !== null && _e !== void 0 ? _e : { error: error.message },
|
|
230
|
+
},
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
const message = ((_g = (_f = error.response) === null || _f === void 0 ? void 0 : _f.data) === null || _g === void 0 ? void 0 : _g.message) ||
|
|
234
|
+
((_j = (_h = error.response) === null || _h === void 0 ? void 0 : _h.data) === null || _j === void 0 ? void 0 : _j.detail) ||
|
|
192
235
|
error.message;
|
|
193
|
-
const base44Error = new Base44Error(message, (
|
|
236
|
+
const base44Error = new Base44Error(message, (_k = error.response) === null || _k === void 0 ? void 0 : _k.status, (_m = (_l = error.response) === null || _l === void 0 ? void 0 : _l.data) === null || _m === void 0 ? void 0 : _m.code, (_o = error.response) === null || _o === void 0 ? void 0 : _o.data, error);
|
|
194
237
|
// Log errors in development
|
|
195
238
|
if (process.env.NODE_ENV !== "production") {
|
|
196
239
|
safeErrorLog("[Base44 SDK Error]", base44Error);
|
package/package.json
CHANGED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns a stable per-browser identifier for an unauthenticated ("anonymous")
|
|
3
|
-
* visitor, creating and persisting one on first use.
|
|
4
|
-
*
|
|
5
|
-
* Sent as the `X-Base44-Anonymous-Id` header on unauthenticated requests so the
|
|
6
|
-
* backend can group an anonymous user's agent conversations and enforce
|
|
7
|
-
* ownership (the header is treated as a bearer-style credential). Persisted in
|
|
8
|
-
* localStorage so it survives reloads; a new browser/device or cleared storage
|
|
9
|
-
* starts a fresh anonymous identity.
|
|
10
|
-
*
|
|
11
|
-
* Returns `null` outside the browser (no `localStorage` / SSR) so callers can
|
|
12
|
-
* skip the header on the server.
|
|
13
|
-
*
|
|
14
|
-
* @internal
|
|
15
|
-
*/
|
|
16
|
-
export declare function getOrCreateAnonymousVisitorId(): string | null;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { v4 as uuidv4 } from "uuid";
|
|
2
|
-
/**
|
|
3
|
-
* localStorage key holding the anonymous visitor id.
|
|
4
|
-
* @internal
|
|
5
|
-
*/
|
|
6
|
-
const ANONYMOUS_VISITOR_ID_STORAGE_KEY = "base44_anonymous_visitor_id";
|
|
7
|
-
/**
|
|
8
|
-
* Returns a stable per-browser identifier for an unauthenticated ("anonymous")
|
|
9
|
-
* visitor, creating and persisting one on first use.
|
|
10
|
-
*
|
|
11
|
-
* Sent as the `X-Base44-Anonymous-Id` header on unauthenticated requests so the
|
|
12
|
-
* backend can group an anonymous user's agent conversations and enforce
|
|
13
|
-
* ownership (the header is treated as a bearer-style credential). Persisted in
|
|
14
|
-
* localStorage so it survives reloads; a new browser/device or cleared storage
|
|
15
|
-
* starts a fresh anonymous identity.
|
|
16
|
-
*
|
|
17
|
-
* Returns `null` outside the browser (no `localStorage` / SSR) so callers can
|
|
18
|
-
* skip the header on the server.
|
|
19
|
-
*
|
|
20
|
-
* @internal
|
|
21
|
-
*/
|
|
22
|
-
export function getOrCreateAnonymousVisitorId() {
|
|
23
|
-
if (typeof window === "undefined" || !window.localStorage) {
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
try {
|
|
27
|
-
const existing = window.localStorage.getItem(ANONYMOUS_VISITOR_ID_STORAGE_KEY);
|
|
28
|
-
if (existing) {
|
|
29
|
-
return existing;
|
|
30
|
-
}
|
|
31
|
-
const minted = uuidv4();
|
|
32
|
-
window.localStorage.setItem(ANONYMOUS_VISITOR_ID_STORAGE_KEY, minted);
|
|
33
|
-
return minted;
|
|
34
|
-
}
|
|
35
|
-
catch (_a) {
|
|
36
|
-
// localStorage unavailable (private mode / sandboxed iframe): no stable id.
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
39
|
-
}
|