@base44-preview/sdk 0.8.40-pr.212.55a476c → 0.8.40-pr.212.84c9784
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/actor.d.ts +0 -7
- package/dist/actor.js +0 -8
- package/dist/client.js +5 -7
- package/dist/modules/actors.d.ts +3 -10
- package/dist/modules/actors.js +1 -10
- package/package.json +1 -1
package/dist/actor.d.ts
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
* At deploy time the bundler replaces this import with the compiled
|
|
9
9
|
* Cloudflare Durable Object implementation — this file provides types only.
|
|
10
10
|
*/
|
|
11
|
-
import type { Base44Client } from "./client";
|
|
12
11
|
/**
|
|
13
12
|
* A single client connection. `Send` is the message type this connection accepts
|
|
14
13
|
* via {@link send} — the actor's *outgoing* (server→client) messages.
|
|
@@ -75,10 +74,4 @@ export declare abstract class Actor<Incoming = unknown, Outgoing = unknown> {
|
|
|
75
74
|
protected stopLoop(): Promise<void>;
|
|
76
75
|
protected get instanceId(): string;
|
|
77
76
|
protected get storage(): Storage;
|
|
78
|
-
/**
|
|
79
|
-
* Anonymous Base44 client scoped to this actor instance — no user or service
|
|
80
|
-
* auth, so entity access is RLS-gated (same as a logged-out visitor).
|
|
81
|
-
* Example: `const rows = await this.client.entities.Score.list();`
|
|
82
|
-
*/
|
|
83
|
-
protected get client(): Base44Client;
|
|
84
77
|
}
|
package/dist/actor.js
CHANGED
|
@@ -60,12 +60,4 @@ export class Actor {
|
|
|
60
60
|
get storage() {
|
|
61
61
|
throw new Error("Actor.storage is only available inside a deployed actor");
|
|
62
62
|
}
|
|
63
|
-
/**
|
|
64
|
-
* Anonymous Base44 client scoped to this actor instance — no user or service
|
|
65
|
-
* auth, so entity access is RLS-gated (same as a logged-out visitor).
|
|
66
|
-
* Example: `const rows = await this.client.entities.Score.list();`
|
|
67
|
-
*/
|
|
68
|
-
get client() {
|
|
69
|
-
throw new Error("Actor.client is only available inside a deployed actor");
|
|
70
|
-
}
|
|
71
63
|
}
|
package/dist/client.js
CHANGED
|
@@ -12,7 +12,7 @@ import { createAppLogsModule } from "./modules/app-logs.js";
|
|
|
12
12
|
import { createUsersModule } from "./modules/users.js";
|
|
13
13
|
import { RoomsSocket } from "./utils/socket-utils.js";
|
|
14
14
|
import { createAnalyticsModule } from "./modules/analytics.js";
|
|
15
|
-
import { createActorsModule
|
|
15
|
+
import { createActorsModule } from "./modules/actors.js";
|
|
16
16
|
/**
|
|
17
17
|
* Creates a Base44 client.
|
|
18
18
|
*
|
|
@@ -51,7 +51,7 @@ import { createActorsModule, resolveActorsHost } from "./modules/actors.js";
|
|
|
51
51
|
* ```
|
|
52
52
|
*/
|
|
53
53
|
export function createClient(config) {
|
|
54
|
-
var _a, _b
|
|
54
|
+
var _a, _b;
|
|
55
55
|
const { serverUrl = "https://base44.app", appId, token, serviceToken, requiresAuth = false, appBaseUrl, options, functionsVersion, headers: optionalHeaders, } = config;
|
|
56
56
|
// Normalize appBaseUrl to always be a string (empty if not provided or invalid)
|
|
57
57
|
const normalizedAppBaseUrl = typeof appBaseUrl === "string" ? appBaseUrl : "";
|
|
@@ -126,9 +126,7 @@ export function createClient(config) {
|
|
|
126
126
|
}
|
|
127
127
|
const actorsModule = createActorsModule({
|
|
128
128
|
appId,
|
|
129
|
-
|
|
130
|
-
// absolute host, so fall back to the page origin.
|
|
131
|
-
host: resolveActorsHost(serverUrl, typeof window !== "undefined" ? (_a = window.location) === null || _a === void 0 ? void 0 : _a.origin : undefined),
|
|
129
|
+
serverUrl,
|
|
132
130
|
functionsVersion,
|
|
133
131
|
getAuthToken: () => token || getAccessToken(),
|
|
134
132
|
});
|
|
@@ -151,7 +149,7 @@ export function createClient(config) {
|
|
|
151
149
|
}
|
|
152
150
|
return headers;
|
|
153
151
|
},
|
|
154
|
-
baseURL: (
|
|
152
|
+
baseURL: (_a = functionsAxiosClient.defaults) === null || _a === void 0 ? void 0 : _a.baseURL,
|
|
155
153
|
}),
|
|
156
154
|
agents: createAgentsModule({
|
|
157
155
|
axios: axiosClient,
|
|
@@ -196,7 +194,7 @@ export function createClient(config) {
|
|
|
196
194
|
}
|
|
197
195
|
return headers;
|
|
198
196
|
},
|
|
199
|
-
baseURL: (
|
|
197
|
+
baseURL: (_b = serviceRoleFunctionsAxiosClient.defaults) === null || _b === void 0 ? void 0 : _b.baseURL,
|
|
200
198
|
}),
|
|
201
199
|
agents: createAgentsModule({
|
|
202
200
|
axios: serviceRoleAxiosClient,
|
package/dist/modules/actors.d.ts
CHANGED
|
@@ -7,17 +7,10 @@ interface ActorsConfig {
|
|
|
7
7
|
/** Same semantics as function calls: editors with a non-prod version get the
|
|
8
8
|
* draft actor script; everyone else gets the published one. */
|
|
9
9
|
functionsVersion?: string;
|
|
10
|
-
/**
|
|
11
|
-
* for localhost)
|
|
12
|
-
|
|
10
|
+
/** The app's own origin; PartySocket strips the scheme and connects wss (ws
|
|
11
|
+
* for localhost), so the socket is same-origin (the app proxies /parties). */
|
|
12
|
+
serverUrl: string;
|
|
13
13
|
}
|
|
14
|
-
/**
|
|
15
|
-
* Absolute host for the actor WebSocket. PartySocket needs an absolute host and
|
|
16
|
-
* can't resolve a relative/empty `serverUrl` (same-origin apps use a relative
|
|
17
|
-
* `/api`, so `serverUrl` is often `""`), so fall back to the page origin.
|
|
18
|
-
* PartySocket handles the scheme (https→wss, ws for localhost).
|
|
19
|
-
*/
|
|
20
|
-
export declare function resolveActorsHost(serverUrl: string, browserOrigin?: string): string;
|
|
21
14
|
export declare function createActorsModule(config: ActorsConfig): {
|
|
22
15
|
module: Record<string, (instanceId: string) => ActorRoom>;
|
|
23
16
|
closeAll: () => void;
|
package/dist/modules/actors.js
CHANGED
|
@@ -28,7 +28,7 @@ class Room {
|
|
|
28
28
|
const connId = (_a = options === null || options === void 0 ? void 0 : options.id) !== null && _a !== void 0 ? _a : crypto.randomUUID();
|
|
29
29
|
this.connId = connId;
|
|
30
30
|
const ws = new PartySocket({
|
|
31
|
-
host: this.config.
|
|
31
|
+
host: this.config.serverUrl,
|
|
32
32
|
party: this.actorName,
|
|
33
33
|
room: this.instanceId,
|
|
34
34
|
id: connId,
|
|
@@ -107,15 +107,6 @@ class Room {
|
|
|
107
107
|
(_b = this.onClose) === null || _b === void 0 ? void 0 : _b.call(this);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
/**
|
|
111
|
-
* Absolute host for the actor WebSocket. PartySocket needs an absolute host and
|
|
112
|
-
* can't resolve a relative/empty `serverUrl` (same-origin apps use a relative
|
|
113
|
-
* `/api`, so `serverUrl` is often `""`), so fall back to the page origin.
|
|
114
|
-
* PartySocket handles the scheme (https→wss, ws for localhost).
|
|
115
|
-
*/
|
|
116
|
-
export function resolveActorsHost(serverUrl, browserOrigin) {
|
|
117
|
-
return serverUrl && !serverUrl.startsWith("/") ? serverUrl : browserOrigin !== null && browserOrigin !== void 0 ? browserOrigin : serverUrl;
|
|
118
|
-
}
|
|
119
110
|
export function createActorsModule(config) {
|
|
120
111
|
// Live rooms this client opened, so client.cleanup() can reclaim any the app
|
|
121
112
|
// forgot to close() (each room removes itself here on close).
|