@base44-preview/sdk 0.8.11-pr.65.dc85e14 → 0.8.12-pr.63.3980328
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/LICENSE +21 -0
- package/dist/modules/agents.types.d.ts +2 -2
- package/dist/modules/analytics.d.ts +0 -1
- package/dist/modules/analytics.js +2 -15
- package/dist/modules/entities.js +13 -8
- package/package.json +8 -6
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 base44
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AxiosInstance } from "axios";
|
|
2
|
-
import { RoomsSocket } from "../utils/socket-utils";
|
|
3
|
-
import { ModelFilterParams } from "../types";
|
|
2
|
+
import { RoomsSocket } from "../utils/socket-utils.js";
|
|
3
|
+
import { ModelFilterParams } from "../types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Reasoning information for an agent message.
|
|
6
6
|
*
|
|
@@ -2,7 +2,6 @@ import { AxiosInstance } from "axios";
|
|
|
2
2
|
import { TrackEventParams, AnalyticsModuleOptions } from "./analytics.types";
|
|
3
3
|
import type { AuthModule } from "./auth.types";
|
|
4
4
|
export declare const USER_HEARTBEAT_EVENT_NAME = "__user_heartbeat_event__";
|
|
5
|
-
export declare const ANALYTICS_REFERRER_EVENT_NAME = "__referrer_event__";
|
|
6
5
|
export declare const ANALYTICS_CONFIG_ENABLE_URL_PARAM_KEY = "analytics-enable";
|
|
7
6
|
export declare const ANALYTICS_SESSION_ID_LOCAL_STORAGE_KEY = "base44_analytics_session_id";
|
|
8
7
|
export interface AnalyticsModuleArgs {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { getSharedInstance } from "../utils/sharedInstance";
|
|
2
|
-
import { generateUuid } from "../utils/common";
|
|
1
|
+
import { getSharedInstance } from "../utils/sharedInstance.js";
|
|
2
|
+
import { generateUuid } from "../utils/common.js";
|
|
3
3
|
export const USER_HEARTBEAT_EVENT_NAME = "__user_heartbeat_event__";
|
|
4
|
-
export const ANALYTICS_REFERRER_EVENT_NAME = "__referrer_event__";
|
|
5
4
|
export const ANALYTICS_CONFIG_ENABLE_URL_PARAM_KEY = "analytics-enable";
|
|
6
5
|
export const ANALYTICS_SESSION_ID_LOCAL_STORAGE_KEY = "base44_analytics_session_id";
|
|
7
6
|
const defaultConfiguration = {
|
|
@@ -21,7 +20,6 @@ const analyticsSharedState = getSharedInstance(ANALYTICS_SHARED_STATE_NAME, () =
|
|
|
21
20
|
requestsQueue: [],
|
|
22
21
|
isProcessing: false,
|
|
23
22
|
isHeartBeatProcessing: false,
|
|
24
|
-
wasReferrerTracked: false,
|
|
25
23
|
sessionContext: null,
|
|
26
24
|
config: {
|
|
27
25
|
...defaultConfiguration,
|
|
@@ -126,8 +124,6 @@ export const createAnalyticsModule = ({ axiosClient, serverUrl, appId, userAuthM
|
|
|
126
124
|
startProcessing();
|
|
127
125
|
// start the heart beat processor //
|
|
128
126
|
clearHeartBeatProcessor = startHeartBeatProcessor(track);
|
|
129
|
-
// track the referrer event //
|
|
130
|
-
trackReferrerEvent(track);
|
|
131
127
|
// start the visibility change listener //
|
|
132
128
|
if (typeof window !== "undefined") {
|
|
133
129
|
window.addEventListener("visibilitychange", onVisibilityChange);
|
|
@@ -170,15 +166,6 @@ function startHeartBeatProcessor(track) {
|
|
|
170
166
|
analyticsSharedState.isHeartBeatProcessing = false;
|
|
171
167
|
};
|
|
172
168
|
}
|
|
173
|
-
function trackReferrerEvent(track) {
|
|
174
|
-
if (typeof window === "undefined" || analyticsSharedState.wasReferrerTracked)
|
|
175
|
-
return;
|
|
176
|
-
analyticsSharedState.wasReferrerTracked = true;
|
|
177
|
-
const referrer = document.referrer;
|
|
178
|
-
if (!referrer)
|
|
179
|
-
return;
|
|
180
|
-
track({ eventName: ANALYTICS_REFERRER_EVENT_NAME, properties: { referrer } });
|
|
181
|
-
}
|
|
182
169
|
function getEventIntrinsicData() {
|
|
183
170
|
return {
|
|
184
171
|
timestamp: new Date().toISOString(),
|
package/dist/modules/entities.js
CHANGED
|
@@ -32,6 +32,10 @@ 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 = typeof window !== "undefined"
|
|
36
|
+
? new URLSearchParams(window.location.search).get("use_staging_db") === "true"
|
|
37
|
+
: false;
|
|
38
|
+
const headers = { "X-Use-Staging-DB": String(isDevMode) };
|
|
35
39
|
return {
|
|
36
40
|
// List entities with optional pagination and sorting
|
|
37
41
|
async list(sort, limit, skip, fields) {
|
|
@@ -44,7 +48,7 @@ function createEntityHandler(axios, appId, entityName) {
|
|
|
44
48
|
params.skip = skip;
|
|
45
49
|
if (fields)
|
|
46
50
|
params.fields = Array.isArray(fields) ? fields.join(",") : fields;
|
|
47
|
-
return axios.get(baseURL, { params });
|
|
51
|
+
return axios.get(baseURL, { params, headers });
|
|
48
52
|
},
|
|
49
53
|
// Filter entities based on query
|
|
50
54
|
async filter(query, sort, limit, skip, fields) {
|
|
@@ -59,31 +63,31 @@ function createEntityHandler(axios, appId, entityName) {
|
|
|
59
63
|
params.skip = skip;
|
|
60
64
|
if (fields)
|
|
61
65
|
params.fields = Array.isArray(fields) ? fields.join(",") : fields;
|
|
62
|
-
return axios.get(baseURL, { params });
|
|
66
|
+
return axios.get(baseURL, { params, headers });
|
|
63
67
|
},
|
|
64
68
|
// Get entity by ID
|
|
65
69
|
async get(id) {
|
|
66
|
-
return axios.get(`${baseURL}/${id}
|
|
70
|
+
return axios.get(`${baseURL}/${id}`, { headers });
|
|
67
71
|
},
|
|
68
72
|
// Create new entity
|
|
69
73
|
async create(data) {
|
|
70
|
-
return axios.post(baseURL, data);
|
|
74
|
+
return axios.post(baseURL, data, { headers });
|
|
71
75
|
},
|
|
72
76
|
// Update entity by ID
|
|
73
77
|
async update(id, data) {
|
|
74
|
-
return axios.put(`${baseURL}/${id}`, data);
|
|
78
|
+
return axios.put(`${baseURL}/${id}`, data, { headers });
|
|
75
79
|
},
|
|
76
80
|
// Delete entity by ID
|
|
77
81
|
async delete(id) {
|
|
78
|
-
return axios.delete(`${baseURL}/${id}
|
|
82
|
+
return axios.delete(`${baseURL}/${id}`, { headers });
|
|
79
83
|
},
|
|
80
84
|
// Delete multiple entities based on query
|
|
81
85
|
async deleteMany(query) {
|
|
82
|
-
return axios.delete(baseURL, { data: query });
|
|
86
|
+
return axios.delete(baseURL, { data: query, headers });
|
|
83
87
|
},
|
|
84
88
|
// Create multiple entities in a single request
|
|
85
89
|
async bulkCreate(data) {
|
|
86
|
-
return axios.post(`${baseURL}/bulk`, data);
|
|
90
|
+
return axios.post(`${baseURL}/bulk`, data, { headers });
|
|
87
91
|
},
|
|
88
92
|
// Import entities from a file
|
|
89
93
|
async importEntities(file) {
|
|
@@ -91,6 +95,7 @@ function createEntityHandler(axios, appId, entityName) {
|
|
|
91
95
|
formData.append("file", file, file.name);
|
|
92
96
|
return axios.post(`${baseURL}/import`, formData, {
|
|
93
97
|
headers: {
|
|
98
|
+
...headers,
|
|
94
99
|
"Content-Type": "multipart/form-data",
|
|
95
100
|
},
|
|
96
101
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@base44-preview/sdk",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.12-pr.63.3980328",
|
|
4
4
|
"description": "JavaScript SDK for Base44 API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -32,15 +32,18 @@
|
|
|
32
32
|
"@types/hast": "^3.0.4",
|
|
33
33
|
"@types/node": "^25.0.1",
|
|
34
34
|
"@types/unist": "^3.0.3",
|
|
35
|
+
"@typescript-eslint/parser": "^8.51.0",
|
|
35
36
|
"@vitest/coverage-istanbul": "^1.0.0",
|
|
36
37
|
"@vitest/coverage-v8": "^1.0.0",
|
|
37
38
|
"@vitest/ui": "^1.0.0",
|
|
38
39
|
"dotenv": "^16.3.1",
|
|
39
|
-
"eslint": "^
|
|
40
|
+
"eslint": "^9.39.2",
|
|
41
|
+
"eslint-plugin-import": "^2.32.0",
|
|
40
42
|
"nock": "^13.4.0",
|
|
41
43
|
"typedoc": "^0.28.14",
|
|
42
44
|
"typedoc-plugin-markdown": "^4.9.0",
|
|
43
45
|
"typescript": "^5.3.2",
|
|
46
|
+
"typescript-eslint": "^8.51.0",
|
|
44
47
|
"vitest": "^1.6.1"
|
|
45
48
|
},
|
|
46
49
|
"keywords": [
|
|
@@ -52,11 +55,10 @@
|
|
|
52
55
|
"license": "MIT",
|
|
53
56
|
"repository": {
|
|
54
57
|
"type": "git",
|
|
55
|
-
"url": "git+https://github.com/base44/sdk.git"
|
|
58
|
+
"url": "git+https://github.com/base44/javascript-sdk.git"
|
|
56
59
|
},
|
|
57
60
|
"bugs": {
|
|
58
|
-
"url": "https://github.com/base44/sdk/issues"
|
|
61
|
+
"url": "https://github.com/base44/javascript-sdk/issues"
|
|
59
62
|
},
|
|
60
|
-
"homepage": "https://github.com/base44/sdk#readme"
|
|
61
|
-
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
|
63
|
+
"homepage": "https://github.com/base44/javascript-sdk#readme"
|
|
62
64
|
}
|